Thank you for implementing pagination!
Sorting does not sort the data of the whole grid. Instead only the current page is sorted. Is this a known issue?
Thank you for implementing pagination!
Sorting does not sort the data of the whole grid. Instead only the current page is sorted. Is this a known issue?
Yes it is, or better say it is a missing feature. As for now the add-on internally supports only in-memory DataProvider. It’s implementation is aware of only the data (page) being loaded at the current moment. Each list of rows is retrieved only when a page is requested.
Further implementation will be required to enable sorting of the whole content of the PaginatedGrid.
Regards,
I would very much appreciate the sorting feature, I hope you will manage to implement it soon :)
Hi,
It would be nice if you implement this feature (If it is possible of course). It is much needed feature. Thanks for this wonderful component.
Sorting feature available in 2.0.6.
It works normally (as in the standard grid) for in-memory data providers.
For lazy-loading data providers it should be the responsibility of the service behind the data provider to retrieve the QuerySortOrders
from the Query and perform data sorting.
Kind regards,
K
Hi. Thank for the update.
I’m trying to sort some lazy-loaded data and I am having a problem. Could you help me?
I’m debugging the sorting of my grid. When I press the sorting arrow in the column header, the sort event listener is called.
I can see, that the event object contains the correct sorting information.
Then the doCalcs method is executed. But there is no information about the sorting order anymore.
There is an inner query, which is being set to the dataProvider, but it does not contain the sorting order.
Later, my method fetchFromBackEnd in my dataProvider is called, but the query in the arguments does not contain the sort order, so the dataProvider thinks, that it should use the default sorting.
I think, that the query, which is handed to the dataProvider should probably contain the sort order.
Hi. Finally, I figured it out. I had to to add .setSortProperty("internal_column_id")
to the column definition and now it works well. This time, the query contains the sort order as expected.
Hi Mark,
Can you post the example code of what you did.
It will be helpful for others facing similar problem.
paginatedGrid.addColumn(ListDto::getDocumentTypeCode)
.setHeader("Type").setSortable(true);
// Sorting did not work properly
paginatedGrid.addColumn(ListDto::getDocumentTypeCode)
.setHeader("Type").setSortProperty("document.documentTypeCode");
// Sorting works well. The sort property is a string,
// an id which is expected by the backend.
Then the dataProvider recieves the sorting criteria, for example:
“document.documentTypeCode” ascending, and has got to pass it to the backend, maybe via a rest service. Later, when the backend reads data from the database, it has to parse the id string and decide how to build the database query with this sort order.