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.
Consumed interfaces
IDataTableSortItem
API
Parameters
Input parameters accepted by this composable.
- pagerequiredRef<number>
- Current page index (1-based). Automatically reset to 1 when the search term changes.
- itemsPerPagerequiredRef<number>
- Number of rows per page. -1 disables pagination (all rows visible).
- sortByrequiredRef<Array<IDataTableSortItem>>
- Active sort descriptors: array of { key, order } objects.
- groupByrequiredRef<Array<IDataTableSortItem>>
- Active group-by descriptors. Empty array = no grouping.
- searchrequiredRef<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
Server-side data with reactive options