Add `getLeafHeaders()` method to skip group headers #6579
Open
sarathkumarsasi(GitHub profile, opens in a new tab)wants to merge 1 commit into
main fromrefs/pull/6579/head·opened Showing 3 changed files with 23 additions and 20 deletions.
x
@@ -58,6 +58,7 @@
- `isPlaceholder`: A boolean flag that is true if the header is a placeholder header. Placeholder headers fill the rows above a shallow leaf column's real header so that every header row accounts for every visible column. Render them as empty cells to keep the header grid aligned, or use `header.rowSpan` to merge each placeholder chain into one vertically spanning header cell.
+- `getLeafHeaders()`: The leaf headers nested under this header, in left-to-right order. Group and placeholder headers are excluded, so a leaf header returns just itself. Use `table.getFlatHeaders()` if you need every header, group headers included.
7 additions and 4 deletions+7-4packages/table-core/src/core/headers/coreHeadersFeature.utils.tsModifiedView file
@@ -19,18 +19,21 @@
+ if (!header.subHeaders.length) {
+ leafHeaders.push(header as Header<TFeatures, TData, TValue>)
+ return
+ }
+
-
- leafHeaders.push(header as Header<TFeatures, TData, TValue>)