Skip to content
Sheetwrite

Sheetwrite / Documentation

createGridController@sheetwrite/core/adapter

Create a grid and wire its lifecycle once, so the React/Vue/Svelte adapters (and any plain host) share a single, drift-free implementation instead of each re-deriving the same create → subscribe → teardown behavior.

Create a grid and wire its lifecycle once, so the React/Vue/Svelte adapters (and any plain host) share a single, drift-free implementation instead of each re-deriving the same create → subscribe → teardown behavior.

initSheetwrite() MUST already have been awaited; createGrid throws otherwise.

Live handlers

handlers is held by reference, not copied. Every event reads the object's current fields (handlers.onGridChange?.(…)), so a host may swap callbacks without rebuilding the grid. Framework adapters must mutate the shared object only from their commit lifecycle; mutating it during render can expose callbacks from work that never commits.

Declaration

function createGridController<Id extends RowBridgeId = RowBridgeId>(
host: HTMLElement,
options: GridOptions,
handlers: GridControllerHandlers<Id>,
rowBridge?: RowBridge<Id>,
): GridController