Skip to content

movable

false keeps the column where you put it.

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

With the columns() feature, the user moves a column by dragging its header or from the keyboard; the column menu moves and pins it; the columns chooser reorders it. movable: false refuses all of these for this column: its header does not drag, the menu’s « Pin » and moves are disabled, the chooser shows it locked. A saved state that places it elsewhere is told and its place is kept.

Other columns still move around it. To keep a column first, put it first in the list and give it movable: false (often with pinned).

import { createGrid, type GridMessages } from '@dzgrid/dom';
import { columns } from '@dzgrid/dom/columns';
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', movable: false },
{ id: 'shelf', header: 'Shelf', type: 'number' },
{ id: 'notes', header: 'Notes' },
],
getRowId: (r) => r.id,
messages,
features: [columns()],
});

Drag Notes before Tool: it moves. Tool stays where it is.