Skip to content

Row Selection

Community

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.

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 },
// …
]

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.