useExpanded

DataTable
stable

Injects the expand context provided by provideExpanded() inside OrigamDataTable. Gives child components access to the expanded rows Set, expand/collapse handlers, and the expandOnClick flag — without prop-drilling.

API

Signature

Signature TypeScript complète extraite du fichier du composable.

typescript

useExpanded() throws if called outside a component tree where provideExpanded() has run. It is safe to call inside any custom cell/row slot of OrigamDataTable.

Interfaces consommées

IDataTableExpandProps
IDataTableProvideExpanded
IDataTableItem

API

Valeurs de retour

Propriétés et méthodes exposées par l'objet retourné par le composable.

expanded
Reactive Set of expanded row keys. Bound to the parent v-model:expanded.
expandOnClick
When true, clicking a row expands it without needing an explicit expand button.
expand
Explicitly expand or collapse a row by its item reference and a boolean flag.
isExpanded
Returns true if the given item's value key is present in the expanded Set.
toggleExpand
Toggles the expanded state of a row — expands it if collapsed, collapses it if expanded.

Usage

Exemples

Extraits de code prêts à coller.

Custom expand cell using useExpanded

vue

DataTable with expandable rows

vue