# DataGridOptions (@salmonui/data-grid/engine)

> The DataGridOptions interface of @salmonui/data-grid/engine.

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

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

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

## Reference

Kind: interface

```ts
interface DataGridOptions<Row> {
    readonly getRowId: (row: Row, index: number) => RowId;
    readonly columns: readonly ColumnDef<Row>[];
    readonly dataSource: readonly Row[] | DataSource<Row>;
    readonly modules?: readonly DataGridModule<Row>[];
    readonly defaultQuery?: DataGridQueryInit;
    readonly id?: string;
    readonly direction?: 'ltr' | 'rtl';
    readonly locale?: string;
    readonly timeZone?: string;
    readonly currency?: string;
    readonly rowHeight?: number | ((row: Row) => number);
    readonly estimatedRowHeight?: number;
    readonly headerRowHeight?: number;
    readonly defaultColumnWidth?: number;
    readonly initialRows?: number;
    readonly initialColumns?: number;
    readonly initialColumnState?: {
        readonly visibility?: Readonly<Record<ColumnId, boolean>>;
        readonly widths?: Readonly<Record<ColumnId, number>>;
        readonly order?: readonly ColumnId[] | null;
        readonly freeze?: Readonly<Record<ColumnId, 'left' | 'right' | 'fixed' | null>>;
        readonly frozenCount?: {
            readonly left?: number;
            readonly right?: number;
        };
    };
    readonly dev?: boolean;
    readonly onWarning?: (warning: DataGridWarning) => void;
    readonly instrument?: boolean;
    readonly recordCommands?: boolean;
    readonly deferDataSource?: boolean;
    readonly cellSpans?: CellSpanResolver;
    readonly [module: string]: unknown;
}
```

Members (23):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `getRowId` | `readonly getRowId: (row: Row, index: number) => RowId;` |  | Required. Index-based ids are never generated by the core. |
| `columns` | `readonly columns: readonly ColumnDef<Row>[];` |  |  |
| `dataSource` | `readonly dataSource: readonly Row[] \| DataSource<Row>;` |  | A plain array is wrapped in `createLocalDataSource`. |
| `modules` | `readonly modules?: readonly DataGridModule<Row>[];` | optional |  |
| `defaultQuery` | `readonly defaultQuery?: DataGridQueryInit;` | optional | Initial query (`where`/`take` equivalent). Modules read their part in `initialState`. |
| `id` | `readonly id?: string;` | optional |  |
| `direction` | `readonly direction?: 'ltr' \| 'rtl';` | optional |  |
| `locale` | `readonly locale?: string;` | optional |  |
| `timeZone` | `readonly timeZone?: string;` | optional |  |
| `currency` | `readonly currency?: string;` | optional | Default ISO 4217 currency for `C` formats. Default `USD`. |
| `rowHeight` | `readonly rowHeight?: number \| ((row: Row) => number);` | optional |  |
| `estimatedRowHeight` | `readonly estimatedRowHeight?: number;` | optional |  |
| `headerRowHeight` | `readonly headerRowHeight?: number;` | optional |  |
| `defaultColumnWidth` | `readonly defaultColumnWidth?: number;` | optional |  |
| `initialRows` | `readonly initialRows?: number;` | optional | Rows in the deterministic server/initial range. Default 20. |
| `initialColumns` | `readonly initialColumns?: number;` | optional | Center columns in the deterministic server/initial range. Default 20. |
| `initialColumnState` | `readonly initialColumnState?: {     readonly visibility?: Readonly<Record<ColumnId, boolean>>;     readonly widths?: Readonly<Record<ColumnId, number>>;     readonly order?: readonly ColumnId[] \| null;     readonly freeze?: Readonly<Record<ColumnId, 'left' \| 'right' \| 'fixed' \| null>>;     readonly frozenCount?: {         readonly left?: number;         readonly right?: number;     }; };` | optional | Initial runtime column visibility, widths (px), and order, applied before the server snapshot. |
| `dev` | `readonly dev?: boolean;` | optional | Development checks and warnings. Defaults to `process.env.NODE_ENV !== 'production'`. |
| `onWarning` | `readonly onWarning?: (warning: DataGridWarning) => void;` | optional |  |
| `instrument` | `readonly instrument?: boolean;` | optional | Expose store counters through `getInstrumentation()`. |
| `recordCommands` | `readonly recordCommands?: boolean;` | optional | Keep a serializable log of applied commands (`getCommandLog()`). |
| `deferDataSource` | `readonly deferDataSource?: boolean;` | optional | Creating the engine performs no data-source side effect: no `subscribe`, no `read` (so no load, fetch, stream, or user callback). Only a local source with a `getRows()` snapshot is read at creation; remote and live reads are requested but held until `connect()` (the snapshot shows their loading state). Renderers set it so creation stays render-pure. |
| `cellSpans` | `readonly cellSpans?: CellSpanResolver;` | optional | Span resolver of a renderer that draws cell spans: focus moves, cell selection, and editing treat a span as one cell at its anchor. Omit it when nothing spans. |
