createDataTable API
Related
Explore these related pages for additional context and usage patterns.
| Page | Category |
|---|---|
| createDataTable | Data |
| createFilter | Data |
| createPagination | Data |
| createVirtual | Data |
Functions
createDataTable
(options?: DataTableOptions<T>) => DataTableContext<T>Creates a data table instance with sort controls, selection, and an
adapter-driven data pipeline.
Rows and columns are both managed via internal registries. Use
table.columns.register({ id, ... }) / table.columns.onboard([...]) to
add columns and table.register({ id, value }) / table.onboard([...])
for rows. Removing entries from the column registry reactively updates
leaves, headers, the sort group, and the filter pipeline.
Must be called inside a component setup() or a Vue effect scope.
Calling at module scope in SSR environments causes request state leakage.
createDataTableContext
(_options?: DataTableContextOptions<T>) => ContextTrinity<DataTableContext<T>>Creates a data table context with dependency injection support.
The returned context exposes both row and column registries. Columns must
be onboarded after construction — pass them via context.columns.onboard,
not in the factory options.
useDataTable
(namespace?: string) => DataTableContext<T>Returns the current data table context from dependency injection.
computeDepth
typeof computeDepthextractLeaves
typeof extractLeavesresolveHeaders
typeof resolveHeadersOptions
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)
Properties
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.
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