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();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();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();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();// JavaScript module for Blazor interop
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
| Kind | Name | Type | Description |
|---|---|---|---|
| Function | createGrid | (options: GridOptions<TRow>) => GridApi<TRow> | Creates a headless instance from rows and columns. |
| Method | getVisibleRows | () => readonly TRow[] | Returns all visible rows in input order. |
| Method | getRowCount | () => number | Counts input rows. |
| Method | dispose | () => void | Releases state. Further API calls throw GridDisposedError. |