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

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

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

```ts
import type { ModuleContext } 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 ModuleContext<Row> {
    getSnapshot(): DataGridSnapshot<Row>;
    getModuleState<T = unknown>(name: string): T | undefined;
    dispatch(command: DataGridCommand): CommandResult;
    getColumns(): ColumnSnapshot<Row>;
    getRows(): RowModelSnapshot<Row>;
    getStageInput(name: PipelineStageName): RowModelSnapshot<Row> | undefined;
    getDataSource(): DataSource<Row>;
    isConnected?(): boolean;
    getRow(rowId: RowId): Row | undefined;
    getRowIndex(rowId: RowId): number;
    getRowIdAt(index: number): RowId | undefined;
    readonly timeZone: string | undefined;
    reject(reason: string, state?: unknown): CommandRejection;
    warn(code: string, message: string): void;
}
```

Members (14):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `getSnapshot` | `getSnapshot(): DataGridSnapshot<Row>;` |  |  |
| `getModuleState` | `getModuleState<T = unknown>(name: string): T \| undefined;` |  |  |
| `dispatch` | `dispatch(command: DataGridCommand): CommandResult;` |  |  |
| `getColumns` | `getColumns(): ColumnSnapshot<Row>;` |  |  |
| `getRows` | `getRows(): RowModelSnapshot<Row>;` |  |  |
| `getStageInput` | `getStageInput(name: PipelineStageName): RowModelSnapshot<Row> \| undefined;` |  | The row model entering a pipeline stage (brings the pipeline up to date first). For a stage skipped because a remote source performed it, the model that would have entered it. Undefined when no module registers it. |
| `getDataSource` | `getDataSource(): DataSource<Row>;` |  |  |
| `isConnected` | `isConnected?(): boolean;` | optional | False until `connect()` for an engine created with `deferDataSource`: modules must not start loads (user callbacks, fetches) before it; see `DataGridModule.onConnect`. |
| `getRow` | `getRow(rowId: RowId): Row \| undefined;` |  | Raw row by id (source rows, including rows filtered out of the view), or undefined. |
| `getRowIndex` | `getRowIndex(rowId: RowId): number;` |  | Visible index of a row (after the pipeline), or -1. |
| `getRowIdAt` | `getRowIdAt(index: number): RowId \| undefined;` |  | Row id at a visible index. |
| `timeZone` | `readonly timeZone: string \| undefined;` |  | The grid `timeZone` option (undefined: the runtime's local zone). |
| `reject` | `reject(reason: string, state?: unknown): CommandRejection;` |  | Rejects the command; `state`, when given, is still applied and notified (the command result stays `rejected`). |
| `warn` | `warn(code: string, message: string): void;` |  |  |
