# setSortModel

Replaces sort criteria and priorities together. An empty array clears all sorting.

Canonical: https://grid.syidax.com/docs/methods/setSortModel/

<a id="meaning"></a>

## What does this API do?

Replaces sort criteria and priorities together. An empty array clears all sorting.

<a id="contract"></a>

## Exact input and result types

```typescript
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>`.

<a id="usage"></a>

## 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.

<a id="recipes"></a>

## Feature explanations and examples

- [Single and multiple sorting](https://grid.syidax.com/docs/features/sorting.md) — Sorting changes display order without modifying data values. Single sorting uses one criterion; multiple sorting uses prioritized criteria.
