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

typescript
setSortModel(model: ReadonlyArray<{ field: string; direction: 'asc' | 'desc' }>): Promise<void>
ArgumentsRequiredType
modelRequiredReadonlyArray<{ 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