useOptions

DataTable
stable

Aggregates DataTable state (page, itemsPerPage, sortBy, groupBy, search) into a single reactive options object and emits update:options whenever any of those refs change. Also resets the page to 1 automatically when the search term changes. Used internally by OrigamDataTable.

API

Signature

Full TypeScript signature sourced from the composable file.

typescript

Consumed interfaces

IDataTableSortItem

API

Parameters

Input parameters accepted by this composable.

page
required
Ref<number>
Current page index (1-based). Automatically reset to 1 when the search term changes.
itemsPerPage
required
Ref<number>
Number of rows per page. -1 disables pagination (all rows visible).
sortBy
required
Ref<Array<IDataTableSortItem>>
Active sort descriptors: array of { key, order } objects.
groupBy
required
Ref<Array<IDataTableSortItem>>
Active group-by descriptors. Empty array = no grouping.
search
required
Ref<string | undefined>
Current search string. Changing this value triggers a page reset and an immediate update:options emit.

Usage

Examples

Ready-to-paste usage snippets.

Listen to DataTable option changes

vue

Server-side data with reactive options

vue