Reputation: 879
I am using a grid with loadOnce:true in order to have only one query to the server. The data is sorted on server side (multi-column sorting). Sorting is disabled on client side.
Before activating the grouping feature, navigation was working correctly.
By activating the grouping feature, the first page is OK. But when I go to the next page with the navigation button, the data is sorted on client-side according to the grouping column (even with groupDataSorted:true).
rowTotal: 10000,
gridview: true,
scroll: false,
loadonce: true,
pgbuttons: true,
pginput: true,
rowNum: 100,
rowList: '',
datatype: 'json',
mtype: 'GET',
grouping: true,
groupingView : {
groupField : ['prodNo'],
groupSummary: [true],
groupColumnShow: [false],
groupText: ['({1})'],
showSummaryOnHide: true,
groupDataSorted : true,
groupCollapse: false
},
jsonReader: {root: 'list', userdata : 'list'},
url:'...'
My case is a bit special because I am sorting the data on server side according to a 'name' and 'date' columns, but grouping rows according to another 'prodNo' column. However I do not understand why the sorting is done on page navigation.
Is there a way to disable this client-side sorting on page navigation ?
thanks in advance
Upvotes: 2
Views: 1891
Reputation: 221997
If you use loadonce: true
and the user click on the "Next Page" button the local data will be resorted by grindexes
(it's the value of index
property of the column which you use for grouping in groupField
). So the easiest way to fix the problem in your case will be to implement custom sorting in the prodNo
column.
You can try first to add to the definition of 'prodNo' column the custom sorting
sorttype: function () {
return 1; // any constant value
}
The function sorttype
will be called during sorting of local data. If it return the same results like in above example then all the data will be interpreted as the same and I hope that no additional sorting will be take place.
If the approach will not work because of some reason you can implement another sorting
sorttype: function (cellValus, rowData) {
...
}
For example if you want that local data will be sorted based on other columns 'name' and 'date' you can return from the sorttype
in the 'prodNo' column the value like
sorttype: function (cellValus, rowData) {
// probably the data need be converted in the sortable form yyyy-mm-dd
return rowData.name + '_' + rowData.data;
}
Upvotes: 4