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 swaps callbacks across renders by mutating the fields of the same object it passed in — never by replacing the object, which the controller would not see. This is what lets a framework feed fresh closures each render without tearing the grid down and rebuilding it.

Declaration

function createGridController(
host: HTMLElement,
options: GridOptions,
handlers: GridControllerHandlers,
): GridController