useHeaders
DataTable
stable
Injects the DataTable header context created by createHeaders. Exposes the parsed multi-row header matrix, the flat column list, and the sort/filter function maps derived from the column definitions.
API
Signature
Signature TypeScript complète extraite du fichier du composable.
useHeaders throws if called outside a component that has createHeaders in its ancestor chain. It relies on Vue provide/inject with ORIGAM_DATA_TABLE_HEADERS_KEY.
Interfaces consommées
IDataTableHeaderProps
IDataTableHeader
IInternalDataTableHeader
API
Paramètres
Paramètres d'entrée acceptés par ce composable.
- propsrequisIDataTableHeaderProps
- createHeaders only — DataTable props including headers definition and items (used to auto-generate columns when headers is omitted).
- options.groupByRef<IDataTableSortItem[]>
- createHeaders only — when set, prepends a data-table-group column to support row grouping.
- options.showSelectRef<boolean>
- createHeaders only — when true, prepends a data-table-select column for row checkboxes.
- options.showExpandRef<boolean>
- createHeaders only — when true, appends a data-table-expand column for row expansion toggles.
API
Valeurs de retour
Propriétés et méthodes exposées par l'objet retourné par le composable.
- headers
- A 2D array representing the header rows. Multi-level headers produce multiple rows; simple tables produce a single row.
- columns
- Flat list of leaf columns (those that represent actual data cells). Used to drive the tbody cell rendering.
- sortFunctions
- Per-column custom sort comparators extracted from the header definitions.
- sortRawFunctions
- Per-column raw sort comparators (operating on unformatted values) extracted from the header definitions.
- filterFunctions
- Per-column filter functions extracted from the header definitions, keyed by column key.
Usage
Exemples
Extraits de code prêts à coller.
Creating headers in a DataTable parent
Consuming headers in a child component