# DataGridSortChangeEvent (@salmonui/data-grid)

> The DataGridSortChangeEvent interface of @salmonui/data-grid: onBeforeSortChange (type: 'beforeSortChange') and onSortChange ('sortChange').

Canonical: https://salmonui.dev/docs/reference/data-grid/DataGridSortChangeEvent

```ts
import type { DataGridSortChangeEvent } from '@salmonui/data-grid';
```

Entry index: https://salmonui.dev/docs/reference/data-grid (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/data-grid.md).

## Reference

Kind: interface

```ts
interface DataGridSortChangeEvent extends DataGridEvent {
    readonly sortBy: readonly DataGridSortItem[];
    readonly previousSortBy: readonly DataGridSortItem[];
    readonly field: string | null;
}
```

`onBeforeSortChange` (`type: 'beforeSortChange'`) and `onSortChange` (`'sortChange'`).

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `sortBy` | `readonly sortBy: readonly DataGridSortItem[];` |  | Proposed (before) or applied (after) sort. |
| `previousSortBy` | `readonly previousSortBy: readonly DataGridSortItem[];` |  |  |
| `field` | `readonly field: string \| null;` |  | Column that triggered the change, if any. |
| `type` | `type: string;` | inherited | `'sortChange'`, `'beforeSortChange'`, ... |
| `source` | `source: DataGridEventSource;` | inherited |  |
| `defaultPrevented` | `defaultPrevented: boolean;` | inherited | True after `preventDefault()` (before-events and click events). |
| `preventDefault` | `preventDefault: () => void;` | inherited | Before-events and click events: cancels the action (or the built-in behavior). |
