LyteNyte Grid logo for light mode. Links back to the documentation home page.
Paginated Data Loading

Paginated Row Sorting

Use the server data source to send a sort model to the server, which sorts the rows before returning each ordered page.

Note

This guide covers sorting on paginated server row data. For client-side sorting, see the Client Row Sorting guide.

Sorting Paginated Rows

To sort rows on the server, define a sort model and send it with each request. The useServerDataSource hook accepts the sort model as part of the queryKey. The sort model can use any structure that fits your application. In most cases, match the format your server or database expects.

The demo below shows paginated row sorting. Click a column header to update that column’s sort state.

Row Pagination Sorting

Fork code on stack blitzFork code on code sandbox

The demo code applies sort state to individual columns. By extending the grid’s API, you can update the sort property on each column directly. The extended API then applies the appropriate sort when the user clicks a column header.

Next Steps