View as Markdown

API reference: @salmonui/data-grid/engine

SelectionMethodstype

import type { SelectionMethods } from '@salmonui/data-grid/engine';

Also exported from @salmonui/data-grid/engine/selection.

type SelectionMethods<Row> = {
    isRowSelected(ctx: ModuleContext<Row>, rowId: RowId): boolean;
    isCellSelected(ctx: ModuleContext<Row>, rowId: RowId, columnId: ColumnId): boolean;
    isColumnSelected(ctx: ModuleContext<Row>, columnId: ColumnId): boolean;
    getSelectedRowIds(ctx: ModuleContext<Row>): readonly RowId[];
    getSummary(ctx: ModuleContext<Row>): SelectionSummary;
    serialize(ctx: ModuleContext<Row>): SerializedSelection;
    preview(ctx: ModuleContext<Row>, command: SelectionCommand): SelectionPreview | null;
};
SelectionMethods members (7)
NameSignatureDescription
isRowSelectedisRowSelected(ctx: ModuleContext<Row>, rowId: RowId): boolean;
isCellSelectedisCellSelected(ctx: ModuleContext<Row>, rowId: RowId, columnId: ColumnId): boolean;
isColumnSelectedisColumnSelected(ctx: ModuleContext<Row>, columnId: ColumnId): boolean;
getSelectedRowIdsgetSelectedRowIds(ctx: ModuleContext<Row>): readonly RowId[];

Selected row ids in selection order (allFiltered: in view order). O(selected).

getSummarygetSummary(ctx: ModuleContext<Row>): SelectionSummary;
serializeserialize(ctx: ModuleContext<Row>): SerializedSelection;
previewpreview(ctx: ModuleContext<Row>, command: SelectionCommand): SelectionPreview | null;

Selection outcome of a command without applying it; null when nothing (rows, cells, columns) would change or the command is rejected.