Row Selection
Introduction
Section titled “Introduction”Row selection highlights whole rows rather than individual cells — the right model
for a list you act on record-by-record (bulk delete, export the checked rows, open
a detail panel). Turn it on with selectionType: 'row':
const grid = new Zengrid(mount, { columns, selectionType: 'row', enableMultiSelection: true, // omit for single-row selection onSelectionChange: (ranges) => { // ranges are row spans in source coordinates },});Clicking a row selects it (and clicking it again clears it). With
enableMultiSelection: true, ctrl/⌘-click adds a row and shift-click takes
the contiguous run from the anchor. Every change fires onSelectionChange with the
selected row spans.
The select-all header checkbox
Section titled “The select-all header checkbox”Give a column a checkbox header and the grid renders a header checkbox that
selects or clears every row — the same select-all the API’s selectAll() runs:
columns: [ { field: 'name', header: { text: '', type: 'checkbox' }, width: 44 }, // …]Try it live
Section titled “Try it live”No enableMultiSelection — exactly one row at a time. Click a row to select it, click it again to clear. onSelectionChange logs each change to the console.
Where to go next
Section titled “Where to go next”- Single Row Selection — restrict to one row at a time.
- Multi-Row Selection — ctrl/shift patterns in depth.
- Selection API — read and drive selection from code.