Skip to content

multiSort

Whether Shift adds a column to the sort, or a grid sorts by one column at a time.

Typeboolean
Defaulttrue
Live update (update())No — read once, when the grid is made
Angularthe [multiSort] input
<dz-grid>the multi-sort attribute
Declared inpackages/dom/src/settings.ts

By default a click on a header sorts by that column alone, and Shift+click (Shift+Enter from the keyboard) adds it after the others: by town, then by name. false keeps one sort only: Shift+click, Shift+Enter and a header part’s toggleSort(true) act as a plain click, replacing the sort.

It limits the user, not your code: a sort of several columns that the application sets itself (sort.set, a saved state) is kept. It is read once: update() refuses a change.

import { createGrid } from '@dzgrid/dom';
import { EN } from '@dzgrid/dom/locales/en';
type Shop = { id: string; town: string; name: string };
createGrid<Shop>(document.getElementById('shops')!, {
rows: [{ id: 's1', town: 'Larkfield', name: 'The Copper Kettle' }],
columns: [{ id: 'town', header: 'Town' }, { id: 'name', header: 'Shop' }],
getRowId: (s) => s.id,
messages: EN,
multiSort: false,
});

Click Town, then Shift+click Shop: the sort is replaced, never added to.