jQuery UI Widgets › Forums › Grid › Gird’s pager not updated properly in virtual mode with server-side sorting
This topic contains 2 replies, has 2 voices, and was last updated by mstavrev 11 years, 3 months ago.
-
Author
-
August 15, 2013 at 6:29 am Gird’s pager not updated properly in virtual mode with server-side sorting #26868
Hello,
I’ve setup a grid in virtual mode with paging. The filtering and sorting is done on the server side and everything works properly.
I’ve also setup a comet-like update of the grid’s data upon server-side event. This also works nicely with one minor glitch – when the user has sorted the grid over a column and grid update reports a changed number of total rows. In this case the pager does not correctly reflect this information. In fact, it stays on the last known total row count it had from last update before sorting was activated. There is no such issue when filter is applied, just when sorting is active.
I’ve verified that the correct total number of records is returned by the server upon refresh with sorting.
Here is the simplified portion of the page code:var source =
{
datatype: ‘json’,
async: true,
cache: false,
root: ‘Rows’,
datafields: [
{ name: ‘id’ },
…
],
id: ‘id’,
url: url,
beforeprocessing: function(data) {
source.totalrecords = data.TotalRows;
},
sort: function() {
// update the grid and send a request to the server.
$(“#jqxgrid”).jqxGrid(‘updatebounddata’, ‘sort’);
},
filter: function() {
// update the grid and send a request to the server.
$(“#jqxgrid”).jqxGrid(‘updatebounddata’, ‘filter’);
}
};var dataAdapter = new $.jqx.dataAdapter(source, {
downloadComplete: function(data, status, xhr) {},
loadComplete: function(data) {
revision = data.Revision;
},
loadError: function(xhr, status, error) { }
});
….
$(“#jqxgrid”).jqxGrid(
{
virtualmode: true,
rendergridrows: function(obj) {
return obj.data;
},
pageable: true,
pagesizeoptions: [20, 50, 100, 500],
pagesize: 50,
source: dataAdapter,
selectionmode: ‘singlerow’,
columnsresize: true,
columnsreorder: true,
sortable: true,
filterable: true,
autoshowfiltericon: true,
showfilterrow: true,
enabletooltips: true,
width: ‘100%’,
height: 400,
columns: […]
});
… The grid update function looks like:var refreshFunction = function() {
$(“#jqxgrid”).jqxGrid(‘updatebounddata’, ‘cells’);
}I’ve tested without supplying the ‘cells’ parameter to ‘updatebounddata’ (and with all the rest of the possible values), unfortunately without success.
This must be something minor as the same works correctly when no column is selected for sorting. It also works when there is no sorting, but the user has typed value in one of the column filters.
Best Regards
August 15, 2013 at 6:33 am Gird’s pager not updated properly in virtual mode with server-side sorting #26874Hi mstavrev,
The Total Rows displayed in the Pager according to me should not be changed when you change the Sort order of the Grid. Here’s a working sample with Server Sorting, Paging and Filtering – http://www.jqwidgets.com/jquery-widgets-demo/demos/php/serverfiltering_paging_and_sorting.htm?web
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comAugust 20, 2013 at 8:50 am Gird’s pager not updated properly in virtual mode with server-side sorting #27178Hello,
I’m using a live source. The total number of rows can change at every request made to retrieve the most recent data. It surely makes sense to expect (or at least be prepared) for the total number of rows to change – the same as it is obviously handled correctly when filtering is in use.
Best Regards
Marin -
AuthorPosts
You must be logged in to reply to this topic.