Rule-driven header cell CSS classes
A headerCellClass column option that accepts a string, an array, or a function returning class names. The function receives the column's current state (sort direction, filter active, pinned, visible index, group depth) and is re-evaluated whenever that state changes. This mirrors the body-cell rule classes of GRID-A07-F19 for header cells without requiring full header templating (GRID-A07-F17). An equivalent option…
Planned. This page shows the specification from issue #211. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A grid with 8 columns. Rules apply 'is-filtered' when a filter is active, 'is-sorted' on the sorted column, and 'numeric-header' as a static class on numeric columns.
Expected behavior
Header classes update immediately as sort, filter and pinning change. Previously applied rule classes are removed when their condition stops being true. Built-in classes are preserved, and switching the rule set followed by refreshHeaderClasses re-applies the classes.
Planned API surface
columnDef.headerCellClass: string | string[] | ((ctx: HeaderClassContext) => string | string[] | undefined)HeaderClassContext { column, colIndex, sort: 'asc'|'desc'|null, filterActive: boolean, pinned: 'left'|'right'|null, api }columnGroupDef.headerGroupClass: same signature with group contextapi.core.refreshHeaderClasses(): voidAcceptance criteria
- String, array and function forms are all supported (pending)
- Classes are recomputed on sort, filter, pin, move, resize-end and column visibility change (pending)
- Only classes added by the rule are removed on recompute; built-in and grid-internal classes are untouched (pending)
- Works for pinned header sections and column-group headers (pending)
- No per-scroll recomputation (performance: recompute only on state change) (pending)