Skip to content

sortable

Whether the rows may be sorted by this column.

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

A click on a sortable column’s title (or Enter on it) sorts by it. sortable: false makes the title a plain title: no click, no sort arrow, no « Sort » in the column menu. A sort your code asks for on it (sort.set, a saved state) is refused with an invalid-sort error.

import { createGrid } from '@dzgrid/dom';
import { EN } from '@dzgrid/dom/locales/en';
type Tool = { id: string; name: string; shelf: number; notes: string };
createGrid<Tool>(document.getElementById('tools')!, {
rows: [{ id: 't1', name: 'Hammer', shelf: 2, notes: 'Claw, 450 g' }],
columns: [
{ id: 'name', header: 'Tool' },
{ id: 'notes', header: 'Notes', sortable: false },
],
getRowId: (r) => r.id,
messages: EN,
});

Click Tool: the rows sort. Click Notes: nothing happens.