Skip to content

Row Select

ColumnRegular (Extended from @revolist/revogrid)

Section titled “ColumnRegular (Extended from @revolist/revogrid)”
interface ColumnRegular {
/**
* Enables checkbox on cells and columns
*/
rowSelect?: boolean | ((model: CellTemplateProp) => boolean)
}

AdditionalData (Extended from @revolist/revogrid)

Section titled “AdditionalData (Extended from @revolist/revogrid)”
interface AdditionalData {
/**
* Row selection plugin configuration.
*
* @deprecated Prefer the direct `grid.rowSelect` property.
*/
rowSelect?: RowSelectConfig
}

HTMLRevoGridElement (Extended from global)

Section titled “HTMLRevoGridElement (Extended from global)”
interface HTMLRevoGridElement {
/**
* Row selection plugin configuration.
*/
rowSelect?: RowSelectConfig
}

HTMLRevoGridElementEventMap (Extended from global)

Section titled “HTMLRevoGridElementEventMap (Extended from global)”
interface HTMLRevoGridElementEventMap {
/**
* Header cell with checkbox clicked
*/
[ROW_ALL_SELECT_EVENT]: RowSelectAllEvent;
/**
* Cell with checkbox clicked in the row
*/
[ROW_SELECT_EVENT]: RowSelectEvent;
/**
* When row selection happened. Returns selected objects.
*/
[ROW_SELECTED_EVENT]: {
selected: Map<DimensionRows, Set<number>>;
visibleCount: number;
visibleRowsCount: number;
count: number;
allRowsCount: number;
}
}
DEFAULT_SEL_PROP: string;

The RowSelectPlugin enables checkbox-based row selection.

Quick setup:

import { RowSelectPlugin } from '@revolist/revogrid-pro';
grid.plugins = [RowSelectPlugin];
grid.columns = [
{ prop: 'select', name: '', rowSelect: true, size: 56 },
{ prop: 'name', name: 'Name' },
];

Public configuration:

APIDefaultMeaning
ColumnRegular.rowSelectfalseRenders a row checkbox for normal data cells in that column. A function can hide the checkbox for specific cells.
grid.rowSelect{ grouping: false, rowOrder: false }Configures optional row-select behavior. Use this for grouping checkboxes and checkbox-driven row ordering.
additionalData.rowSelectnoneLegacy alias for grid.rowSelect. Prefer the direct grid property.
rowSelect.groupingfalseOpt-in checkbox support for RevoGrid grouping rows. Use true or { enabled: true }.
rowSelect.rowOrderfalseOpt-in RowOrderPlugin integration. When enabled, dragging a checked row moves visible checked rows before range selection.

Index and count semantics:

TermMeaning
Data rowA real row from the user source data.
Synthetic grouping rowA row generated by RevoGrid grouping. It can render a group checkbox, but it is never stored as selected data.
Physical row indexThe index stored in rowselected.detail.selected. For grouped rows this maps back to the original data row index, not the synthetic group source position.
Visible rowsRows currently visible after filtering, sorting, grouping expansion/collapse, tree expansion/collapse, and row ordering.
countNumber of selected real data rows across the full data set.
allRowsCountNumber of selectable real data rows across the full data set. Synthetic grouping rows are excluded.
visibleCountNumber of selected real data rows currently visible.
visibleRowsCountNumber of selectable real data rows currently visible.

Behavior matrix:

CaseBehavior
Flat rowsClicking a row checkbox toggles that data row. Header select-all toggles all currently matching data rows.
Shift-clickSelects the visible data-row range between the previous selected row and the clicked row. Synthetic group rows are skipped.
FilteringSelection stays attached to physical data rows. rowselected is re-emitted so visible counts reflect the filtered view.
SortingSelection stays attached to physical data rows after sort order changes. rowselected is re-emitted.
Row dragSelection stays attached to physical data rows after row order changes. rowselected is re-emitted.
Grouping disabledGroup rows do not render checkboxes, even when a row-select column exists.
Grouping enabledGroup rows render checkboxes only when a visible row-select column exists.
Group checkbox clickSelects or clears all descendant real data rows in that group. Group rows themselves are not selected.
Group child roll-upSome selected children make the group checkbox indeterminate. All selected children make it checked. Ancestor groups update the same way.
Collapsed groupsHeader select-all toggles matching real data rows, including descendants hidden by collapsed groups.
Tree parent clickWhen TreeDataPlugin is registered, clicking a tree parent checkbox toggles that parent and all descendants.
Tree child clickClicking a tree leaf/child without descendants toggles only that row.
Checkbox row-orderWhen rowSelect.rowOrder is enabled, dragging a checked row moves visible checked rows as a compact block. Dragging an unchecked row keeps current range/single-row behavior.

Events:

EventConstantUse it for
rowselectclickROW_SELECT_EVENTInternal/plugin integration point for toggling one row.
rowallselectclickROW_ALL_SELECT_EVENTInternal/plugin integration point for toggling all matching selectable rows.
rowselectedROW_SELECTED_EVENTPublic application event. Read selected, count, allRowsCount, visibleCount, and visibleRowsCount.

rowselected.detail.selected is a Map<DimensionRows, Set<number>> keyed by row type. The set contains physical indexes for real data rows only.

  • Event integration tree-data: Integrates with TreeDataPlugin descendant selection events when present.
class RowSelectPlugin {
/**
* Returns physical selected row indexes
*/
getSelectedIndexes();
/**
* Returns visible checkbox-selected rows for RowOrderPlugin integration.
*/
getRowOrderSelection(
type: DimensionRows,
draggedVisibleRowIndex: number,
): RowSelectRowOrderSelection | null;
destroy();
}

class RowSelectColumnType {}

Normalizes public row selection configuration to the internal shape.

export function normalizeRowSelectConfig(
config?: boolean | RowSelectConfig,
): NormalizedRowSelectConfig;

Grouped row checkbox configuration for the row selection plugin.

interface RowSelectGroupingConfig {
/**
* Enables checkbox rendering on RevoGrid grouping rows.
*
* Disabled by default. When enabled, selecting a group checkbox selects or
* clears all descendant data rows while synthetic group rows stay out of the
* selected index set.
*/
enabled?: boolean
}

Checkbox-selected row-order integration configuration.

interface RowSelectRowOrderConfig {
/**
* Enables RowOrderPlugin integration with checkbox-selected rows.
*
* Disabled by default. When enabled, dragging a checked row moves all
* visible checked rows in the same row viewport as a compact block.
*/
enabled?: boolean
}

Row selection plugin configuration.

Set this on grid.rowSelect. additionalData.rowSelect is supported as a compatibility alias, but the direct grid property is preferred.

Examples:

grid.rowSelect = { grouping: true };
grid.rowSelect = { grouping: { enabled: true } };
grid.rowSelect = { grouping: false };
grid.rowSelect = { rowOrder: true };
grid.rowSelect = { rowOrder: { enabled: true } };
interface RowSelectConfig {
/**
* Enables row selection integration with RevoGrid grouping.
*
* Defaults to `false`. Use `true` for the compact form or
* `{ enabled: true }` for the future-compatible object form.
*/
grouping?: boolean | RowSelectGroupingConfig;
/**
* Enables checkbox-selected row drag integration with RowOrderPlugin.
*
* Defaults to `false`. Use `true` for the compact form or
* `{ enabled: true }` for the future-compatible object form.
*/
rowOrder?: boolean | RowSelectRowOrderConfig
}

Internal normalized row selection configuration.

interface NormalizedRowSelectConfig {
grouping: {
enabled: boolean;
};
rowOrder: {
enabled: boolean;
}
}

Default row selection configuration.

Group row checkboxes are opt-in and disabled by default.

DEFAULT_ROW_SELECT_CONFIG: {
grouping: { enabled: false; };
rowOrder: { enabled: false; };
};

export function isRowSelectGroupingRow(row: DataType | undefined): boolean;

export function getRowSelectIndex(
source: DataType[],
physicalIndex: number,
): number;

export function collectGroupLeafIndexes(
source: DataType[],
groupIndex: number,
matchesGroupValue: GroupValueMatcher = defaultGroupValueMatcher,
orderedIndexes?: number[],
): number[];

export function getGroupSelectionState(
selected: Set<number>,
source: DataType[],
groupIndex: number,
): GroupSelectionState;

export function createGroupSelectionStateLookup(
selected: Set<number>,
source: DataType[],
matchesGroupValue: GroupValueMatcher = defaultGroupValueMatcher,
orderedIndexes?: number[],
): Map<number, GroupSelectionState>;

export function getVisibleSelectableIndexes(
source: DataType[],
items: number[],
): number[];

export function countSelectableIndexes(
source: DataType[],
items: number[],
): number;

export function countSelectedIndexes(
selected: Set<number>,
source: DataType[],
): number;

export function countSelectedVisibleIndexes(
selected: Set<number>,
source: DataType[],
items: number[],
): number;

export function applySelectionToIndexes(
selected: Set<number>,
indexes: number[],
shouldSelect: boolean,
);

export function getVisibleSelectionRange(
source: DataType[],
items: number[],
fromPhysicalIndex: number,
toPhysicalIndex: number,
): number[];

interface GroupSelectionState {
selected: boolean;
indeterminate: boolean;
selectedCount: number;
totalCount: number
}

ROW_SELECT_ORIGINAL_INDEX: string;

export type GroupValueMatcher = (
row: DataType,
prop: ColumnProp,
value: unknown,
) => boolean;

export function resolveRowSelectRowOrderSelection(;

interface RowSelectRowOrderSelection {
items: Map<number, DataType>;
rowIndexes: number[]
}

interface ResolveRowSelectRowOrderSelectionOptions {
draggedVisibleRowIndex: number;
enabled: boolean;
selected: Set<number> | undefined;
source: DataType[];
visibleItems: number[]
}

export type RowSelectEvent = CellTemplateProp & { originalEvent: MouseEvent };

RowSelectAllEvent (Extended from index.ts)

Section titled “RowSelectAllEvent (Extended from index.ts)”
export type RowSelectAllEvent = ColumnTemplateProp & {
selected: boolean;
type: DimensionCols;
};

Runtime contract exposed by RowSelectPlugin for row-order integrations.

interface RowSelectRowOrderProvider {
getRowOrderSelection(
type: DimensionRows,
draggedVisibleRowIndex: number,
): RowSelectRowOrderSelection | null
}

export function defaultGroupValueMatcher(
row: DataType,
prop: ColumnProp,
value: unknown,
): boolean;