View as Markdown

API reference: @salmonui/data-grid/engine

ModuleContextinterface

import type { ModuleContext } from '@salmonui/data-grid/engine';
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;
}
ModuleContext members (14)
NameSignatureDescription
getSnapshotgetSnapshot(): DataGridSnapshot<Row>;
getModuleStategetModuleState<T = unknown>(name: string): T | undefined;
dispatchdispatch(command: DataGridCommand): CommandResult;
getColumnsgetColumns(): ColumnSnapshot<Row>;
getRowsgetRows(): RowModelSnapshot<Row>;
getStageInputgetStageInput(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.

getDataSourcegetDataSource(): DataSource<Row>;
isConnectedoptionalisConnected?(): boolean;

False until connect() for an engine created with deferDataSource: modules must not start loads (user callbacks, fetches) before it; see DataGridModule.onConnect.

getRowgetRow(rowId: RowId): Row | undefined;

Raw row by id (source rows, including rows filtered out of the view), or undefined.

getRowIndexgetRowIndex(rowId: RowId): number;

Visible index of a row (after the pipeline), or -1.

getRowIdAtgetRowIdAt(index: number): RowId | undefined;

Row id at a visible index.

timeZonereadonly timeZone: string | undefined;

The grid timeZone option (undefined: the runtime's local zone).

rejectreject(reason: string, state?: unknown): CommandRejection;

Rejects the command; state, when given, is still applied and notified (the command result stays rejected).

warnwarn(code: string, message: string): void;