This section covers Server-side Sorting using the Server-side Row Model.
Sorting is enabled in the grid via the
sortable column definition attribute. Some example column
definitions with sorting enabled are shown below:
For more details on sorting configurations see the section on Row Sorting.
Sorting on the Server
The actual sorting of rows is performed on the server when using the Server-side Row Model. When a sort is applied
in the grid a request is made for more rows via
getRows(params) on the
Server-side Datasource. The
supplied params includes a request containing sort metadata contained in the
An example of the contents contained in the
sortModel is shown below:
Notice in the snippet above that the
sortModel contains an array of sorts for each column that has
active sorts in the grid. The column id and sort type can then be used by the server to perform the actual sorting.
Example: Server-side Sorting
The example below demonstrates server-side sorting. Notice the following:
- Try single / multi column (using shift key) sorting by clicking on columns headers.
- All columns have sorting enabled using the
defaultColDefgrid options property with
- The server uses the metadata contained in the
sortModelto sort the rows.
- Open the browsers dev console to view the
sortModelsupplied in the request to the datasource.
Fake Server Implementation
However note that the Server-side Row Model does not impose any restrictions on the server-side technologies used.
Continue to the next section to learn about Server-side Filtering.