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.
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt