API reference: @salmonui/data-grid
DataGridSelectionChangeEventinterface
import type { DataGridSelectionChangeEvent } from '@salmonui/data-grid';interface DataGridSelectionChangeEvent<Row> extends DataGridEvent {
readonly rowIds: readonly RowId[];
readonly added: readonly RowId[];
readonly removed: readonly RowId[];
rows(): readonly Row[];
readonly cells: readonly DataGridCellKey[];
readonly addedCells: readonly DataGridCellKey[];
readonly removedCells: readonly DataGridCellKey[];
readonly columns: readonly string[];
readonly addedColumns: readonly string[];
readonly removedColumns: readonly string[];
readonly scope: 'explicit' | 'allFiltered';
readonly excludedRowIds: readonly RowId[];
readonly ctrlKey: boolean;
readonly shiftKey: boolean;
readonly target: 'row' | 'cell' | 'column' | 'checkbox' | null;
}
onBeforeSelectionChange / onSelectionChange: one event per selection command, for row, cell and column
selection, selecting and deselecting alike. Every selection field is the selection after the change (proposed
in the before-event, applied in the after-event); target names the part the command selects. Large fields
are computed on first read; read them synchronously. Built only while a handler is bound.
| Name | Signature | Description |
|---|---|---|
rowIds | readonly rowIds: readonly RowId[]; | Selected row ids after the change. |
added | readonly added: readonly RowId[]; | Rows that become selected / deselected. |
removed | readonly removed: readonly RowId[]; | |
rows | rows(): readonly Row[]; | Selected rows (raw references), in |
cells | readonly cells: readonly DataGridCellKey[]; | Selected cells after the change: the anchor and focus cell of each range, like |
addedCells | readonly addedCells: readonly DataGridCellKey[]; | Cells that become selected / deselected (every cell of the changed ranges; O(cells in the ranges)). |
removedCells | readonly removedCells: readonly DataGridCellKey[]; | |
columns | readonly columns: readonly string[]; | Selected column fields after the change. |
addedColumns | readonly addedColumns: readonly string[]; | Columns that become selected / deselected. |
removedColumns | readonly removedColumns: readonly string[]; | |
scope | readonly scope: 'explicit' | 'allFiltered'; |
|
excludedRowIds | readonly excludedRowIds: readonly RowId[]; | |
ctrlKey | readonly ctrlKey: boolean; | |
shiftKey | readonly shiftKey: boolean; | |
target | readonly target: 'row' | 'cell' | 'column' | 'checkbox' | null; | |
typeinherited | type: string; |
|
sourceinherited | source: DataGridEventSource; | |
defaultPreventedinherited | defaultPrevented: boolean; | True after |
preventDefaultinherited | preventDefault: () => void; | Before-events and click events: cancels the action (or the built-in behavior). |