createDataGrid API
API reference for the createDataGrid composable.
Related
Explore these related pages for additional context and usage patterns.
| Page | Category |
|---|---|
| createDataGrid | Data |
| createDataTable | Data |
| createFilter | Data |
| createPagination | Data |
| createVirtual | Data |
Functions
createDataGrid
(_options?: DataGridOptions<T>) => DataGridContext<T>Creates a data grid instance with layout, editing, row ordering, and spanning layered on top of the createDataTable pipeline. Rows live on the inherited registry surface — register them with `grid.onboard(rows.map(value => ({ id: value.id, value })))` or `grid.register({ id, value })`.
createDataGridContext
(_options?: DataGridContextOptions<T>) => ContextTrinity<DataGridContext<T>>Creates a data grid context with dependency injection support.
useDataGrid
(namespace?: string) => DataGridContext<T>Returns the current data grid context from dependency injection.
Options
pagination
Omit<PaginationOptions, "size"> | undefinedPagination options (size derived from pipeline)
selectStrategy
SelectStrategy | undefinedSelection strategy: 'single' selects one row, 'page' operates on visible items, 'all' operates on all filtered items.
Default: 'page'
locale
string | undefinedLocale for sorting (defaults to useLocale's selected locale or browser default)
editing
{ onEdit?: (row: ID, column: string, value: unknown, item: T) => void; } | undefinedpreserveRowOrder
MaybeRefOrGetter<boolean> | undefinedrowSpanning
((item: T, column: string) => number) | undefinedProperties
columns
RegistryContext<DataTableColumnTicketInput<T>, DataTableColumnTicket<T>>Column registry. Use `columns.register({...})`, `columns.onboard([...])`, `columns.unregister(id)`, and `columns.clear()` to manage columns. The registry is reactive — `leaves` and `headers` recompute when it mutates.
leaves
Readonly<Ref<readonly DataTableColumnTicket<T>[], readonly DataTableColumnTicket<T>[]>>Leaf columns (no children) used by the data pipeline. Reactive.
headers
Readonly<Ref<InternalHeader[][], InternalHeader[][]>>2D header grid with colspan/rowspan for rendering thead. Reactive.
grouping
DataTableGrouping<T>Row grouping controls. When groupBy is not set, `groups` returns an empty array.
layout
ColumnLayoutediting
CellEditingspans
ComputedRef<Map<ID, Map<string, SpanEntry>>>Methods
seek
(direction?: "first" | "last", from?: number, predicate?: (ticket) => boolean) => E | undefinedSeek for a ticket based on direction and optional predicate
on
<K extends Extensible<RegistryEventName>>(event: K, cb: RegistryEventCallback<E, K>) => voidListen for registry events
off
<K extends Extensible<RegistryEventName>>(event: K, cb: RegistryEventCallback<E, K>) => voidStop listening for registry events
emit
<K extends Extensible<RegistryEventName>>(event: K, data: EventPayload<E, K>) => voidEmit an event with data
offboard
(ids: ID[]) => Partial<Z>[]Offboard multiple tickets at once, returning the input shapes that were removed.
batch
<R>(fn: () => R) => RExecute operations in a batch, deferring cache invalidation and event emission until complete
rows
{ order: Readonly<Ref<ID[]>>; move: (id: ID, toIndex: number) => void; reset: () => void; }