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

Signature TypeScript complète extraite du fichier du composable.

typescript

Interfaces consommées

IDataTableSortItem

API

Paramètres

Paramètres d'entrée acceptés par ce composable.

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

Usage

Exemples

Extraits de code prêts à coller.

Listen to DataTable option changes

vue

Server-side data with reactive options

vue