# SortChangeDetail

> _Since v0.1.1_

Detail for a sort change (direction 0 indicates cleared sort).

#### Example

```typescript
grid.on('sort-change', ({ field, direction }) => {
  if (direction === 0) {
    console.log(`Sort cleared on ${field}`);
  } else {
    const dir = direction === 1 ? 'ascending' : 'descending';
    console.log(`Sorted by ${field} ${dir}`);
  }

  // Fetch sorted data from server
  fetchData({ sortBy: field, sortDir: direction });
});
```

## Properties

| Property | Type | Description |
| -------- | ---- | ----------- |
| `field` | <code>string</code> | Sorted field key. |
| `direction` | <code>-1 &#124; 0 &#124; 1</code> | Direction: 1 ascending, -1 descending, 0 cleared. |

## See Also

- [`SortState`](/grid/api/core/interfaces/sortstate.md) for the sort state object
- [`SortHandler`](/grid/api/core/types/sorthandler.md) for custom sort handlers
