Skip to content

menu

Takes the column menu away from one column.

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

With the columnMenu() feature, every header has a ⋮ button, a right-click menu and the keys Alt+ArrowDown and Shift+F10 to open it. menu: false removes all three from this column’s header; the keys are then left to the page. Sorting by a click on the title is unchanged (sortable says that).

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' },
{ id: 'shelf', header: 'Shelf', type: 'number', menu: false },
],
getRowId: (r) => r.id,
messages,
features: [columnMenu()],
});

Shelf has no ⋮ button and no right-click menu.