API reference: @salmonui/data-grid/engine
SelectionApiinterface
import type { SelectionApi } from '@salmonui/data-grid/engine';Also exported from @salmonui/data-grid/engine/selection.
interface SelectionApi<Row> {
selectRows(rowIds: RowId | readonly RowId[], options?: {
mode?: RowMode;
}): CommandResult;
selectRowRange(fromId: RowId, toId: RowId, options?: {
mode?: 'replace' | 'add';
}): CommandResult;
toggleRowSelection(rowId: RowId): CommandResult;
selectAll(): CommandResult;
selectAllFiltered(): CommandResult;
clearSelection(parts?: {
rows?: boolean;
cells?: boolean;
columns?: boolean;
}): CommandResult;
selectCells(cells: readonly CellKey[], options?: {
mode?: 'replace' | 'add' | 'toggle';
}): CommandResult;
selectCellRange(anchor: CellKey, focus: CellKey, options?: {
mode?: 'replace' | 'add';
}): CommandResult;
selectColumns(columnIds: ColumnId | readonly ColumnId[], options?: {
mode?: 'replace' | 'add' | 'toggle';
}): CommandResult;
isRowSelected(rowId: RowId): boolean;
getSelectedRowIds(): readonly RowId[];
getSelectedRows(): readonly Row[];
getSelection(): SerializedSelection | undefined;
setSelection(selection: SerializedSelection): CommandResult;
getSelectionSummary(): SelectionSummary | undefined;
}
| Name | Signature | Description |
|---|---|---|
selectRows | selectRows(rowIds: RowId | readonly RowId[], options?: {
mode?: RowMode;
}): CommandResult; | Replaces by default; |
selectRowRange | selectRowRange(fromId: RowId, toId: RowId, options?: {
mode?: 'replace' | 'add';
}): CommandResult; | Selects the rows between two ids (visible order). |
toggleRowSelection | toggleRowSelection(rowId: RowId): CommandResult; | |
selectAll | selectAll(): CommandResult; | Ctrl+A: every row of the current page (all rows without paging). |
selectAllFiltered | selectAllFiltered(): CommandResult; | Every row matching the query on every page, O(1) (scope |
clearSelection | clearSelection(parts?: {
rows?: boolean;
cells?: boolean;
columns?: boolean;
}): CommandResult; | Clears every selection, or only the |
selectCells | selectCells(cells: readonly CellKey[], options?: {
mode?: 'replace' | 'add' | 'toggle';
}): CommandResult; | |
selectCellRange | selectCellRange(anchor: CellKey, focus: CellKey, options?: {
mode?: 'replace' | 'add';
}): CommandResult; | |
selectColumns | selectColumns(columnIds: ColumnId | readonly ColumnId[], options?: {
mode?: 'replace' | 'add' | 'toggle';
}): CommandResult; | |
isRowSelected | isRowSelected(rowId: RowId): boolean; | |
getSelectedRowIds | getSelectedRowIds(): readonly RowId[]; | Selected row ids. |
getSelectedRows | getSelectedRows(): readonly Row[]; | Selected raw rows, in the order of |
getSelection | getSelection(): SerializedSelection | undefined; | Serializable selection (scope, ids or excluded ids, cell ranges, columns). |
setSelection | setSelection(selection: SerializedSelection): CommandResult; | |
getSelectionSummary | getSelectionSummary(): SelectionSummary | undefined; |