View as Markdown

API reference: @salmonui/data-grid/engine

DataGridEngineWithModulestype

import type { DataGridEngineWithModules } from '@salmonui/data-grid/engine';
type DataGridEngineWithModules<Row, Modules extends readonly unknown[]> = DataGridEngine<Row> & UnionToIntersection<ModuleFacade<ColumnsModule<Row>> | ModuleFacade<Modules[number]>>;

Engine plus the generated command façade of the built-in columns module and every registered module.

DataGridEngineWithModules members (35, 35 inherited)
NameSignatureDescription
idinheritedid: string;
getSnapshotinheritedgetSnapshot: () => DataGridSnapshot<Row>;
getServerSnapshotinheritedgetServerSnapshot: () => DataGridSnapshot<Row>;
subscribeinheritedsubscribe: (listener: () => void) => () => void;
selectinheritedselect: <T>(selector: (snapshot: DataGridSnapshot<Row>) => T) => T;
subscribeSelectorinheritedsubscribeSelector: <T>(selector: (snapshot: DataGridSnapshot<Row>) => T, listener: (value: T) => void, isEqual?: ((a: T, b: T) => boolean) | undefined) => () => void;
subscribeCellinheritedsubscribeCell: (rowId: string, columnId: string, listener: () => void) => () => void;
subscribeRowinheritedsubscribeRow: (rowId: string, listener: () => void) => () => void;
subscribeHeaderinheritedsubscribeHeader: (columnId: string, listener: () => void) => () => void;
subscribeModuleinheritedsubscribeModule: (name: string, listener: () => void) => () => void;
getCellSnapshotinheritedgetCellSnapshot: (rowId: string, columnId: string) => CellSnapshot | undefined;
getRowSnapshotinheritedgetRowSnapshot: (rowId: string) => RowSnapshot<Row> | undefined;
getHeaderSnapshotinheritedgetHeaderSnapshot: (columnId: string) => HeaderSnapshot | undefined;
getModuleStateinheritedgetModuleState: <T = unknown>(name: string) => T | undefined;
getSelectorinheritedgetSelector: (moduleName: string, selectorName: string) => ((snapshot: DataGridSnapshot<Row>) => unknown) | undefined;
getRowinheritedgetRow: (rowId: string) => Row | undefined;

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

getRowIndexinheritedgetRowIndex: (rowId: string) => number;

Visible index of a row, or -1.

getRowAtinheritedgetRowAt: (index: number) => Row | undefined;
getRowIdAtinheritedgetRowIdAt: (index: number) => string | undefined;
getCellValueinheritedgetCellValue: (rowId: string, columnId: string) => unknown;
getDataSourceinheritedgetDataSource: () => DataSource<Row>;
setColumnsinheritedsetColumns: (columns: readonly ColumnDef<Row>[]) => void;

Recompiles only when the array identity or a definition identity changes.

setLocaleinheritedsetLocale: (next: { readonly locale?: string; readonly currency?: string; readonly timeZone?: string | undefined; readonly direction?: "ltr" | "rtl"; }) => boolean;

Changes the locale, currency, time zone, or direction at runtime. A format change recompiles the column formatters once and re-runs the pipeline (collation follows the locale); a direction change updates snapshot.direction and the focus module. Omitted fields keep their value (timeZone: undefined given explicitly resets to the runtime zone). Returns false when nothing changed.

dispatchinheriteddispatch: (command: DataGridCommand) => CommandResult;
hasCommandinheritedhasCommand: (type: string) => boolean;

Whether a registered module declares the command type (UI commands probe it before dispatching).

batchinheritedbatch: (run: () => void) => void;
onBeforeCommandinheritedonBeforeCommand: (listener: (event: BeforeCommandEvent) => void | string | boolean) => () => void;
onCommandinheritedonCommand: (listener: (event: CommandEvent) => void) => () => void;
getCommandLoginheritedgetCommandLog: () => readonly DataGridCommand[];
getInstrumentationinheritedgetInstrumentation: () => DataGridInstrumentation | null;
connectinheritedconnect: () => () => void;

With deferDataSource: subscribes to the source and issues the pending read. Returns the disconnect (unsubscribes, aborts the in-flight read, which the next connect() re-issues). A no-op when already connected.

reloadinheritedreload: () => void;

Re-reads the data source with the current query (retry after a data error). Before connect() the read waits for it.

refreshinheritedrefresh: () => void;

Refresh: drops the row and cell snapshot caches, invalidates the source cache (DataSource.invalidate), aborts and re-issues the current read, and keeps every module state (sort, filter, group, page, selection, expansion). Rows mutated in place render their new values.

disposedinheriteddisposed: boolean;
disposeinheriteddispose: () => void;