groupable
Keeps a column out of row grouping and of the pivot’s columns.
| Type | boolean |
|---|---|
| Default | true |
Live update (update()) | Yes — give the columns again (update({ columns })) |
| Declared in | packages/core/src/columns/defs.ts |
What it does
Section titled “What it does”With the grouping() feature, rows can be grouped by a column’s values: from the column menu, the
grouping zone, the pivot bar or your code. groupable: false refuses this column in all of them — a free text, an
amount, an id. Your code naming it in grouping.by (or as a pivot column) is told with an invalid-setting warning,
and the column is skipped.
Example
Section titled “Example”import { createGrid, type GridMessages } from '@dzgrid/dom';import { grouping } from '@dzgrid/dom/grouping';import { EN_GROUP } from '@dzgrid/dom/locales/en-group';import { EN } from '@dzgrid/dom/locales/en';
type Tool = { id: string; name: string; shelf: number; notes: string };
const messages: GridMessages = { ...EN, text: { ...EN.text, ...EN_GROUP.text } };
createGrid<Tool>(document.getElementById('tools')!, { rows: [{ id: 't1', name: 'Hammer', shelf: 2, notes: 'Claw, 450 g' }], columns: [ { id: 'name', header: 'Tool', groupable: false }, { id: 'shelf', header: 'Shelf', type: 'number' }, ], getRowId: (r) => r.id, messages, features: [grouping({ by: ['shelf'] })],});