jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Server-side sorting and total rows
This topic contains 3 replies, has 2 voices, and was last updated by Peter Stoev 9 years, 7 months ago.
-
Author
-
I discovered I have the same problem that this person had: http://www.jqwidgets.com/community/topic/girds-pager-not-updated-properly-in-virtual-mode-with-server-side-sorting/
I am using virtual mode, paging, and sorting. Everything is working correctly except in the case when I change the sort and the total rows is not updated. I have verified that I am returning the correct total rows from the server, except the grid will not update the value when only the sort column is changed.
We have the requirement that we do a different query when the user sorts on certain columns. For instance if we are sorting on Title then we see 1 row per title and if they had 2 barcodes for that title, they are shown in one column combined as “123456789; 987654321”. However if they sort on Barcode, then we need to expand those so the user can see them in sorted order, so we’d have 2 rows return, one with barcode 123456789 and the other with 987654321. This is why we are changing the number of rows when the sort is changed: the user is trying to view things differently and we return that expanded data appropriately.
Any way to work around this and make the grid refresh its total rows after a sort?
Hi mkrajew,
Example: http://www.jqwidgets.com/jquery-widgets-demo/demos/php/serverfiltering_paging_and_sorting.htm?arctic. When totalrecords value is updated where and when it should be, there would be no issues. A scenario when Sorting is applied and the number of records is changed should be more considered as Filtering, not Sorting. You can always call additional methods like updatebounddata to refresh the Grid, if that for some reason is necessary.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Thanks for the information. In the data source.sort method we were calling
$("#jqxMyRecordsGrid").jqxGrid('updatebounddata', 'sort');
and that did not update the total rows. However if I change that to
$("#jqxMyRecordsGrid").jqxGrid('updatebounddata', 'filter');
then the totalrows does work. I don’t seem to see any other side effects to passing ‘filter’ instead of ‘sort’. What’s the difference (other than it now seems to update totalrows correctly)?Hi mkrajew,
The difference is that Sorting is not supposed to change the totalrows. It is supposed to Sort only the data.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.