Skip to content

hideable

For a column that must stay on screen.

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

hideable: false disables the column menu’s « Hide column » for it, and the columns chooser cannot untick it. A saved state that hides it is told, and the column stays shown. Your code can still hide it with hidden.

The grid never lets the user hide the last shown column, whatever this option says.

import { createGrid, type GridMessages } from '@dzgrid/dom';
import { columnMenu } from '@dzgrid/dom/column-menu';
import { EN_COLUMN_MENU } from '@dzgrid/dom/locales/en-column-menu';
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_COLUMN_MENU.text } };
createGrid<Tool>(document.getElementById('tools')!, {
rows: [{ id: 't1', name: 'Hammer', shelf: 2, notes: 'Claw, 450 g' }],
columns: [
{ id: 'name', header: 'Tool', hideable: false },
{ id: 'notes', header: 'Notes' },
],
getRowId: (r) => r.id,
messages,
features: [columnMenu()],
});

Open Tool’s menu (⋮): « Hide column » is disabled. Notes’ is not.