jqGrid grouping - deactivating client side sorting on page navigation

前端 未结 1 1475
死守一世寂寞
死守一世寂寞 2021-01-14 19:30

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 o

1条回答
  •  伪装坚强ぢ
    2021-01-14 19:40

    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;
    }
    

    0 讨论(0)
提交回复
热议问题