jQuery UI Widgets › Forums › TreeGrid › Sorting and Row Position
Tagged: #jquerytreegrid, grid, jquery tree data grid, jquery tree list, treegrid
This topic contains 14 replies, has 3 voices, and was last updated by Goga 7 years, 9 months ago.
-
AuthorSorting and Row Position Posts
-
I’m trying to determine whether a given row is in the first or last position in the tree grid display. I am able to do this by evaluating $(“#treeGrid”).jqxTreeGrid(‘getRows’) and comparing my row id to the row id of the first and last array elements.
However, when I use a column sort, $(“#treeGrid”).jqxTreeGrid(‘getRows’) returns the rows in exactly the same order as before the sort. Is there any way to evaluate row ordering after a column sort?
Hi tdemeo,
There is no method for that in jqxTreeGrid. The rendered rows and bound rows are different things and the rendered rows are built internally and displayed to the users. getRows returns the Array of rows loaded in the widget from its data source i.e it may not match the rendering order.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hello.
Interesting bug, after sorting programmatically work with the TreeGrid is impossible.
This bug is fixed or there is a workaround?Best Regards
GogaHi Goga,
I do not think that there is any bug here and I find your post a bit irrelevant to the topic.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter.
Why irrelevant the topic? I was faced with the same problem.
In the tree there is no link between the visual rows and the data source after sorting.
For example: after sorting, there is no way (through API) to know the UID of the first visual ROW.
It turns out that after sorting it is not possible to work programmatically with TreeGrid.Best Regards
GogaHi Goga,
There is API in the TreeGrid which allows you to get the rows so you can work programatically with it
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter.
It’s great, apparently I was not careful.
Peter, please tell me how to get the UID first visual row after sorting?Best Regards
GogaUse getRows method of the TreeGrid. It returns the ROWS loaded in the TreeGrid. It is not affected by Sorting. Example: http://jsfiddle.net/ot3j6575/
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/it’s your incorrect example of work:
2 Andrew Fuller
8 Laura Callahan
1 Nancy Davolio
3 Janet Leverling
4 Margaret Peacock
5 Steven Buchanan
6 Michael Suyama
7 Robert King
9 Anne Dodsworthif I get the UID of second (or 3, 4, 5 and etc.) visual row I will get the incorrect value:
– for seconr row I get UID=8, and the correct value = 5Goga. Results are exactly as they should be. UID is not Visual ID. It seems that you misunderstood what getRows returns or do not read my posts.
” It returns the ROWS loaded in the TreeGrid. It is not affected by Sorting” This means that getRows always returns the same array of rows and SORTING does not affect the results. Hope it is clear now.Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI repeat my question:
how to get the UID first (second, and etc.) visual row after sorting?
I can’t perform a basic task:
– after downloading data from the server I need to sort the TreeGrid and select the first rowThe Selection in the TreeGrid is by UID, not by Visual Row. We do not have API for getting the order of the rows
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comwould it be correct to take the uid in this way?
function getUid(rowindex) {
return $(“#jqxgrid”).find(‘#contenttablejqxgrid’).find(‘tr’).attr(‘role’, “row”).eq(rowindex).attr(‘data-key’);
}Best Regards
GogaHi Goga,
I think you know the answer as you are not confident in that solution. The answer is – it depends on. It depends on whether the TreeGrid has Paging enabled, it depends on whether the TreeGrid is filtered, too.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.