Sorting
The Grid enables you to sort single and multiple data-bound columns.
Getting Started
To enable sorting:
- Set the sortable option of the Kendo UI Grid for Angular.
- To properly handle the sorting functionality, set the field option of the column. When sortable is configured and the user tries to sort a column, the sortChange event is emitted.
- Handle the
sortChange
event. - Manually sort the data.
Setting the Direction
The Grid allows you to set the sorting direction to ascending or descending by configuring the dir
property of the SortDescriptor to asc
or desc
respectively. If dir
is not set, the descriptor will not be processed.
To set the initial sorting configuration, bind the sort property of the Grid to a collection of sort descriptors. For more information on how to process data collections, refer to the article on the process helpers for bulk data operations.
The following example demonstrates how to set a sortable Grid with initially applied sorting configuration.
Enabling multi-sort
The sorting feature of the Grid enables you to sort the records by multiple columns. To enable the sorting of multiple columns, set the mode
property of the SortSettings to multiple
.
Sort Key Modifier
The multi-sort behavior offers a configuration option that enables the ability to only apply multi-sort when a specified multiSortKey
is used in combination with column selection while regular selection will un-sort any other currently sorted column.