API REFERENCE

sortBy

Sets one column's sorting. Omitted direction cycles sorting; null clears that column. Use setSortModel for the full multi-column model.

What does this API do?

Sets one column's sorting. Omitted direction cycles sorting; null clears that column. Use setSortModel for the full multi-column model.

Exact input and result types

typescript
sortBy(column: string, direction?: GridSortDirection | null): Promise<void>
ArgumentsRequiredType
columnRequiredstring
directionOptionalGridSortDirection | null

The return type is Promise<void>.

Usage flow

After registering and initializing the Grid element, call grid.sortBy(…). Read the return value with await. For methods returning a boolean or report, inspect the result before continuing.

Read related types

Feature explanations and examples