Skip to content
Sheetwrite

Sheetwrite / Documentation

GridControllerHandlers@sheetwrite/core/adapter

Event callbacks a host (a framework adapter, or any plain app) hangs off a grid's lifecycle.

Event callbacks a host (a framework adapter, or any plain app) hangs off a grid's lifecycle.

The controller reads these fields live on every event — see createGridController — so a host may swap any callback at any time by mutating the fields of the object it passed in, without recreating the grid. Every field is optional; a missing callback simply drops that event.

Members 13

onGridChange Forwarded from the grid's change event (a committed transaction).
onGridChange?(event: ChangeEvent): void;
onRowDelta Forwarded as a typed host-row projection when a bridge is attached.
onRowDelta?(projection: Parameters<RowBridgeHandler<Id>>[0]): void;
onSelectionChange Forwarded from the grid's selection event; null when nothing is selected.
onSelectionChange?(selection: Selection | null): void;
onViewportChange Forwarded from the grid's scroll event.
onViewportChange?(event: GridEvents["scroll"]): void;
onEditBegin Forwarded when a cell editor opens.
onEditBegin?(event: GridEvents["edit-begin"]): void;
onEditCommit Forwarded after a cell editor commits.
onEditCommit?(event: GridEvents["edit-commit"]): void;
onCommandStateChange Forwarded whenever command availability or formatting activity changes.
onCommandStateChange?(event: GridEvents["command-state-change"]): void;
onActiveSheetChange Forwarded after the visible sheet changes.
onActiveSheetChange?(event: GridEvents["active-sheet"]): void;
onMutationRejected Forwarded when a Grid mutation is rejected.
onMutationRejected?(event: GridEvents["mutation-rejected"]): void;
onRendererFallback Forwarded when worker rendering falls back to the main-thread canvas renderer.
onRendererFallback?(event: GridEvents["renderer-fallback"]): void;
onDatasourceError Forwarded when a datasource request fails.
onDatasourceError?(event: GridEvents["datasource-error"]): void;
onExportError Forwarded when a built-in XLSX export action fails.
onExportError?(event: GridEvents["export-error"]): void;

Declaration

View full TypeScript declaration
export interface GridControllerHandlers<
Id extends RowBridgeId = RowBridgeId,
> {
onGridChange?(event: ChangeEvent): void;
onRowDelta?(projection: Parameters<RowBridgeHandler<Id>>[0]): void;
onSelectionChange?(selection: Selection | null): void;
onViewportChange?(event: GridEvents["scroll"]): void;
onEditBegin?(event: GridEvents["edit-begin"]): void;
onEditCommit?(event: GridEvents["edit-commit"]): void;
onSearch?(result: GridEvents["search"]): void;
onCommandStateChange?(event: GridEvents["command-state-change"]): void;
onActiveSheetChange?(event: GridEvents["active-sheet"]): void;
onMutationRejected?(event: GridEvents["mutation-rejected"]): void;
onRendererFallback?(event: GridEvents["renderer-fallback"]): void;
onDatasourceError?(event: GridEvents["datasource-error"]): void;
onExportError?(event: GridEvents["export-error"]): void;
}