Skip to content

SelectionMethods

Selection methods returned from useGridSelection.

Uses React context to access the grid ref - works reliably regardless of when the grid mounts or conditional rendering.

PropertyTypeDescription
selectAll() => voidSelect all rows (row mode) or all cells (range mode).
clearSelection() => voidClear all selection.
getSelection() => SelectionResult | unknownGet the current selection state. Use this to derive selected rows, indices, etc.
isCellSelected(row: number, col: number) => booleanCheck if a specific cell is selected.
setRanges(ranges: CellRange[]) => voidSet selection ranges programmatically.
getSelectedRows() => TRow[]Get actual row objects for the current selection. Works in all selection modes (row, cell, range) — resolves indices against the grid’s processed (sorted/filtered) rows.
selectionSelectionResult | unknownReactive selection state. Re-renders the component whenever the selection changes. null when no SelectionPlugin is active or nothing is selected. v2.5.0+
selectedRowIndicesnumber[]Reactive selected row indices (sorted ascending). Empty in cell/range modes or when nothing is selected. v2.5.0+
selectedRowsTRow[]Reactive selected row objects. Works in all selection modes. v2.5.0+
isReadybooleanWhether the grid has finished its first render and the selection plugin has been discovered. v2.5.0+

Get actual row objects for the current selection. Works in all selection modes (row, cell, range) — resolves indices against the grid’s processed (sorted/filtered) rows.

This is the recommended way to get selected rows. Unlike manual index mapping, it correctly resolves rows even when the grid is sorted or filtered.

For reactive selected rows, use selectedRows instead.


Reactive selected row indices (sorted ascending). Empty in cell/range modes or when nothing is selected.

Prefer selectedRows for getting actual row objects — it handles index-to-object resolution correctly regardless of sorting/filtering.