Programmatic selection API
Developers can set, read and clear ranges in code, using row IDs and column IDs rather than visual indices. This makes the selection stable across sorting and lets apps sync the selection with URLs or external panels.
Planned. This page shows the specification from issue #191. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
A grid next to a JSON editor that holds the range definitions.
Expected behavior
Applying the JSON selects the ranges and scrolls the first range into view. Events report source='api'. When anchorBy=rowId, sorting keeps the same logical cells selected.
Planned API surface
setSelectedRanges()getSelectedRanges()clearRangeSelection()rangeSelection.anchorByselection:rangeChange(source)Acceptance criteria
- setSelectedRanges rejects unknown column IDs with a typed error and does not change the selection (pending)
- Every event payload includes source: 'pointer' | 'keyboard' | 'api' (pending)
- The selection survives a sort when anchorBy=rowId (pending)