On this page
Framework-neutral readiness, change, and error callbacks shared by adapters.
Members 15
onGridChange
onGridChange Receives every committed Grid change, including its applied transaction.
onRowDelta Receives projected host-row effects when a row bridge is attached.
onSelectionChange Receives the current selection, or null after it is cleared.
onSelectionChange?: (selection: Selection | null) => void;
onViewportChange Receives visible row bounds and vertical scroll offset after scrolling.
onViewportChange?: (event: GridEvents["scroll"]) => void;
onEditBegin Fires when cell editing begins.
onEditBegin?: (event: GridEvents["edit-begin"]) => void;
onEditCommit Fires after an edit commits its parsed cell value.
onEditCommit?: (event: GridEvents["edit-commit"]) => void;
onSearch Receives refreshed search matches and active-match index.
onSearch?: (result: GridEvents["search"]) => void;
onActiveSheetChange Fires after the visible sheet changes.
onActiveSheetChange?: (event: GridEvents["active-sheet"]) => void;
onCommandStateChange Receives observable undo/redo and formatting command state.
onCommandStateChange?: (event: GridEvents["command-state-change"]) => void;
onMutationRejected Receives structured issues when a Grid mutation is rejected.
onMutationRejected?: (event: GridEvents["mutation-rejected"]) => void;
onRendererFallback Fires when worker rendering falls back to the main-thread canvas renderer.
onRendererFallback?: (event: GridEvents["renderer-fallback"]) => void;
onDatasourceError Receives failed datasource requests and their errors.
onDatasourceError?: (event: GridEvents["datasource-error"]) => void;
onExportError Receives failures from built-in XLSX export actions.
onExportError?: (event: GridEvents["export-error"]) => void;
onReady Fires after the adapter publishes a ready Grid generation.
onInitializationError Receives a WASM initialization failure while the adapter remains mounted.
Declaration
View full TypeScript declaration
export interface GridAdapterEventHandlers<
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; onActiveSheetChange?: (event: GridEvents["active-sheet"]) => void; onCommandStateChange?: (event: GridEvents["command-state-change"]) => 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;
Referenced by
Workspace packages depending on @sheetwrite/core
@sheetwrite/benchdependency
@sheetwrite/docs-startdependency
@sheetwrite/reactdependency
@sheetwrite/sveltedependency
@sheetwrite/vuedependency
@sheetwrite/xlsxdependency
Public exports naming GridAdapterEventHandlers
interface ChangeEvent {
transaction: Transaction;
changes: CellChange[];
commitReason: CommitReason;
source: OperationSource;
epoch?: number;
}interface ChangeEvent {
transaction: Transaction;
changes: CellChange[];
commitReason: CommitReason;
source: OperationSource;
epoch?: number;
}interface ChangeEvent {
transaction: Transaction;
changes: CellChange[];
commitReason: CommitReason;
source: OperationSource;
epoch?: number;
}Payload of the change event; flows OUT for API submission/reconcile.API reference →type RowBridgeHandler<Id extends RowBridgeId = RowBridgeId> = (
projection: RowBridgeProjection<Id>,
) => void;type RowBridgeHandler<Id extends RowBridgeId = RowBridgeId> = (
projection: RowBridgeProjection<Id>,
) => void;type RowBridgeHandler<
Id extends RowBridgeId =
RowBridgeId,
> = (
projection: RowBridgeProjection<Id>,
) => void;Callback accepted by imperative and framework adapters.API reference →type Selection =
| { kind: "cell"; addr: CellAddress }
| { kind: "range"; range: Range }
| { kind: "row"; sheet: SheetId; row: number }
| { kind: "column"; sheet: SheetId; col: number }
| { kind: "multi"; ranges: Range[] };type Selection =
| { kind: "cell"; addr: CellAddress }
| { kind: "range"; range: Range }
| { kind: "row"; sheet: SheetId; row: number }
| { kind: "column"; sheet: SheetId; col: number }
| { kind: "multi"; ranges: Range[] };type Selection =
| {
kind: "cell";
addr: CellAddress;
}
| {
kind: "range";
range: Range;
}
| {
kind: "row";
sheet: SheetId;
row: number;
}
| {
kind: "column";
sheet: SheetId;
col: number;
}
// … 4 more lines — see the API reference
}Current cell, range, row, column, or multi-range selection.API reference →interface GridEvents {
change: ChangeEvent;
selection: { selection: Selection | null };
scroll: {
scrollTop: number;
firstRow: number;
lastRow: number;
scrollLeft: number;
firstVisibleColumn: number | null;
lastVisibleColumn: number | null;
};
"edit-begin": { addr: CellAddress };
"edit-commit": { addr: CellAddress; value: CellValue };
search: SearchResult;
"command-state-change": GridCommandStateChangeEvent;
// … 17 more lines — see the API reference
}interface GridEvents {
change: ChangeEvent;
selection: { selection: Selection | null };
scroll: {
scrollTop: number;
firstRow: number;
lastRow: number;
scrollLeft: number;
firstVisibleColumn: number | null;
lastVisibleColumn: number | null;
};
"edit-begin": { addr: CellAddress };
"edit-commit": { addr: CellAddress; value: CellValue };
search: SearchResult;
"command-state-change": GridCommandStateChangeEvent;
// … 17 more lines — see the API reference
}interface GridEvents {
change: ChangeEvent;
selection: {
selection: Selection | null;
};
scroll: {
scrollTop: number;
firstRow: number;
lastRow: number;
scrollLeft: number;
firstVisibleColumn:
number | null;
lastVisibleColumn:
number | null;
};
"edit-begin": {
addr: CellAddress;
};
"edit-commit": {
// … 31 more lines — see the API reference
}Payload map for events emitted by a Grid.API reference →interface GridReadyEvent {
grid: Grid;
generation: number;
reason: GridReadyReason;
}interface GridReadyEvent {
grid: Grid;
generation: number;
reason: GridReadyReason;
}interface GridReadyEvent {
grid: Grid;
generation: number;
reason: GridReadyReason;
}Grid handle, generation, and reason published after adapter initialization.API reference →class SheetwriteError
extends Error
implements SheetwriteErrorEnvelope
{
constructor(
code: SheetwriteErrorCode,
operation: SheetwriteErrorOperation,
message: string,
options?: SheetwriteErrorOptions,
);
code:
| "aborted"
| "batch-limit"
| "blocked"
| "buffer-byte-limit"
// … 78 more lines — see the API reference
}class SheetwriteError
extends Error
implements SheetwriteErrorEnvelope
{
constructor(
code: SheetwriteErrorCode,
operation: SheetwriteErrorOperation,
message: string,
options?: SheetwriteErrorOptions,
);
code:
| "aborted"
| "batch-limit"
| "blocked"
| "buffer-byte-limit"
// … 78 more lines — see the API reference
}class SheetwriteError
extends Error
implements
SheetwriteErrorEnvelope
{
constructor(
code: SheetwriteErrorCode,
operation: SheetwriteErrorOperation,
message: string,
options?: SheetwriteErrorOptions,
);
code:
| "aborted"
| "batch-limit"
| "blocked"
| "buffer-byte-limit"
| "buffer-count-limit"
| "buffer-operation-limit"
| "comment-failed"
// … 80 more lines — see the API reference
}Canonical envelope for thrown and callback-delivered Sheetwrite failures.API reference →type RowBridgeId = string | number;type RowBridgeId = string | number;type RowBridgeId =
string | number;A stable host identity for one data-space row.API reference →