Skip to content

chooser

Keeps a column out of the list where the user shows, hides and orders columns.

Typefalse
Defaultnot set
Live update (update())Yes — give the columns again (update({ columns }))
Declared inpackages/core/src/columns/defs.ts

The columns chooser (columnsChooser() from @dzgrid/dom/columns-panel) lists every column with a box to show or hide it. chooser: false leaves this column out of that list — a technical column, one your app shows on its own terms. The column menu can still hide it, unless hideable is false.

import { createGrid, type GridMessages } from '@dzgrid/dom';
import { columnsChooser } from '@dzgrid/dom/columns-panel';
import { EN_COLUMNS } from '@dzgrid/dom/locales/en-columns';
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_COLUMNS.text } };
createGrid<Tool>(document.getElementById('tools')!, {
rows: [{ id: 't1', name: 'Hammer', shelf: 2, notes: 'Claw, 450 g' }],
columns: [
{ id: 'name', header: 'Tool' },
{ id: 'shelf', header: 'Shelf', type: 'number', chooser: false },
],
getRowId: (r) => r.id,
messages,
features: [columnsChooser()],
});

Open a menu (⋮), then « Choose columns… »: Shelf is not in the list.