WarUI documentation

Headless grid instance

experimental

Call createGrid with rows and columns in the main thread or a Web Worker.

Live example

Expected behavior

Both environments return the same rows and count. After disposal, API calls raise GridDisposedError.

Source

import { createGrid } from '@warlockcode/warui-core';

const grid = createGrid({
  columns: [{ id: 'name', field: 'name' }],
  rows: [{ name: 'Product 1' }],
});
const rows = grid.getVisibleRows();
const count = grid.getRowCount();
grid.dispose();

API reference

GRID-A01-F01 API
KindNameTypeDescription
FunctioncreateGrid(options: GridOptions<TRow>) => GridApi<TRow>Creates a headless instance from rows and columns.
MethodgetVisibleRows() => readonly TRow[]Returns all visible rows in input order.
MethodgetRowCount() => numberCounts input rows.
Methoddispose() => voidReleases state. Further API calls throw GridDisposedError.