Skip to content

Data sources

A DataSource is the seam between the grid and your data. The built-in InMemoryDataSource covers the common case; for server-backed data, implement the interface or use one of the included helpers.

In-memory

import { InMemoryDataSource, useDataSource } from 'strata-grid';
const source = new InMemoryDataSource(seed);
const dataSource = useDataSource(source);
<DataGrid data={dataSource.data} columns={columns} />;
Name
Qty

Server-scale helpers

HookPurpose
useServerDataSourceFetch rows from a server-capable data source.
useLazyTreeLazy-load tree children on first expand.
usePaginationPage state and PaginationBar wiring.
useLiveUpdatesApply incremental add/update/delete/refresh events.
useWhereUsedWalk parent chains for where-used lookups.
useQuickSearchDebounced search input and filter expression state.
useFilterBuilderCompose nested filter expressions.

OData adapter

import { ODataDataSource } from 'strata-grid';
const source = new ODataDataSource({
serviceUrl: '/odata',
entitySet: 'BillOfMaterialItems',
idProperty: 'id',
fieldMapping: {
ID: 'id',
Material: 'material',
},
});

See the API reference for the full interface.