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

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

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

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

Also exported from `@salmonui/data-grid`.

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 LocalDataSource<Row> extends DataSource<Row> {
    readonly mode: 'local';
    getRows(): readonly Row[];
    setRows(rows: readonly Row[]): void;
    patch(patch: LocalDataPatch<Row>): void;
    write(request: WriteRequest<Row>): Promise<WriteResult<Row>>;
    subscribe(listener: (event: DataSourceEvent<Row>) => void): () => void;
}
```

Members (9):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `mode` | `readonly mode: 'local';` |  |  |
| `getRows` | `getRows(): readonly Row[];` |  |  |
| `setRows` | `setRows(rows: readonly Row[]): void;` |  |  |
| `patch` | `patch(patch: LocalDataPatch<Row>): void;` |  |  |
| `write` | `write(request: WriteRequest<Row>): Promise<WriteResult<Row>>;` |  |  |
| `subscribe` | `subscribe(listener: (event: DataSourceEvent<Row>) => void): () => void;` |  |  |
| `read` | `read: (request: DataSourceRequest) => DataSourceResult<Row> \| Promise<DataSourceResult<Row>>;` | inherited |  |
| `invalidate` | `invalidate?: ((scope?: "all" \| "counts" \| "facets" \| "rows" \| undefined) => void);` | optional, inherited | Drops cached results; `engine.refresh()` calls it with `'all'` before re-reading. Must not notify. |
| `capabilities` | `capabilities?: Partial<DataSourceCapabilities>;` | optional, inherited |  |
