API REFERENCE
setSortModel
Replaces sort criteria and priorities together. An empty array clears all sorting.
What does this API do?
Replaces sort criteria and priorities together. An empty array clears all sorting.
Exact input and result types
setSortModel(model: ReadonlyArray<{ field: string; direction: 'asc' | 'desc' }>): Promise<void>| Arguments | Required | Type |
|---|---|---|
| model | Required | ReadonlyArray<{ field: string; direction: 'asc' | 'desc' }> |
The return type is Promise<void>.
Usage flow
After registering and initializing the Grid element, call grid.setSortModel(…). Read the return value with await. For methods returning a boolean or report, inspect the result before continuing.
Feature explanations and examples
- Single and multiple sorting
Sorting changes display order without modifying data values. Single sorting uses one criterion; multiple sorting uses prioritized criteria.