sortable
Whether the rows may be sorted by this column.
| Type | boolean |
|---|---|
| Default | true |
Live update (update()) | Yes — give the columns again (update({ columns })) |
| Declared in | packages/core/src/columns/defs.ts |
What it does
Section titled “What it does”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.
Example
Section titled “Example”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,});Live demo
Section titled “Live demo”Click Tool: the rows sort. Click Notes: nothing happens.