Skip to content

Column Groups

Use columnGroups to display nested header bands above leaf columns.

const grid = new Grid<Product>({
container,
columnDefs: [
{ key: 'id', name: 'ID', width: 64, pinned: 'start' },
{ key: 'name', name: 'Product', width: 200 },
{ key: 'category', name: 'Category', width: 130 },
{ key: 'quantity', name: 'Qty', width: 90 },
{ key: 'price', name: 'Price', width: 110 },
],
columnGroups: [
{ groupId: 'catalog', name: 'Catalog', children: ['name', 'category'] },
{
groupId: 'inventory',
name: 'Inventory',
children: [
'quantity',
{ groupId: 'valuation', name: 'Valuation', children: ['price'] },
],
},
],
rowData,
});
  • Header Height Stacking: Each group nesting level adds one header row (headerRowHeight or --next-grid-header-row-height, default 30 px).
  • Static Group Topology: columnGroups are static declarations; column state (getColumnState / applyColumnState) persists leaf columns only.
  • Pinning & Visibility: Hidden leaf columns omit their cells from group spans; if all leaves in a group are hidden, the group header hides automatically. Groups span contiguous leaves within the same pin zone.
  • Replacing Definitions: When calling setColumnDefs, pass { columnGroups } if you remove a column referenced by an existing group.