API reference: @salmonui/data-grid
DataGridSelectionApiinterface
import type { DataGridSelectionApi } from '@salmonui/data-grid';interface DataGridSelectionApi<Row> {
selectRows(rowIds: RowId | readonly RowId[], options?: {
mode?: 'replace' | 'add' | 'remove' | 'toggle';
}): DataGridActionResult;
selectRowRange(fromRowId: RowId, toRowId: RowId, options?: {
mode?: 'replace' | 'add';
}): DataGridActionResult;
selectAll(options?: {
scope?: 'page' | 'filtered';
}): DataGridActionResult;
clearSelection(parts?: {
rows?: boolean;
cells?: boolean;
columns?: boolean;
}): DataGridActionResult;
selectCells(cells: readonly DataGridCellKey[], options?: {
mode?: 'replace' | 'add' | 'toggle';
}): DataGridActionResult;
selectCellRange(anchor: DataGridCellKey, focus: DataGridCellKey, options?: {
mode?: 'replace' | 'add';
}): DataGridActionResult;
selectColumns(fields: string | readonly string[], options?: {
mode?: 'replace' | 'add' | 'toggle';
}): DataGridActionResult;
isRowSelected(rowId: RowId): boolean;
getSelectedRowIds(): readonly RowId[];
getSelectedRows(): readonly Row[];
getSelectedCells(): readonly DataGridCellKey[];
getSelectedColumns(): readonly string[];
getSelection(): SerializedSelection | undefined;
setSelection(selection: SerializedSelection): DataGridActionResult;
getSelectionSummary(): SelectionSummary | undefined;
}
Row and cell selection methods (ids and fields).
| Name | Signature | Description |
|---|---|---|
selectRows | selectRows(rowIds: RowId | readonly RowId[], options?: {
mode?: 'replace' | 'add' | 'remove' | 'toggle';
}): DataGridActionResult; | |
selectRowRange | selectRowRange(fromRowId: RowId, toRowId: RowId, options?: {
mode?: 'replace' | 'add';
}): DataGridActionResult; | |
selectAll | selectAll(options?: {
scope?: 'page' | 'filtered';
}): DataGridActionResult; |
|
clearSelection | clearSelection(parts?: {
rows?: boolean;
cells?: boolean;
columns?: boolean;
}): DataGridActionResult; | |
selectCells | selectCells(cells: readonly DataGridCellKey[], options?: {
mode?: 'replace' | 'add' | 'toggle';
}): DataGridActionResult; | |
selectCellRange | selectCellRange(anchor: DataGridCellKey, focus: DataGridCellKey, options?: {
mode?: 'replace' | 'add';
}): DataGridActionResult; | |
selectColumns | selectColumns(fields: string | readonly string[], options?: {
mode?: 'replace' | 'add' | 'toggle';
}): DataGridActionResult; | |
isRowSelected | isRowSelected(rowId: RowId): boolean; | |
getSelectedRowIds | getSelectedRowIds(): readonly RowId[]; | |
getSelectedRows | getSelectedRows(): readonly Row[]; | Raw rows, in the order of |
getSelectedCells | getSelectedCells(): readonly DataGridCellKey[]; | |
getSelectedColumns | getSelectedColumns(): readonly string[]; | |
getSelection | getSelection(): SerializedSelection | undefined; | Serializable selection (scope, ids or excluded ids, cell ranges, columns). |
setSelection | setSelection(selection: SerializedSelection): DataGridActionResult; | |
getSelectionSummary | getSelectionSummary(): SelectionSummary | undefined; |