TanStack

TableOptions_CellSelection

Interface: TableOptions_CellSelection<TFeatures, TData>

Defined in: features/cell-selection/cellSelectionFeature.types.ts:89

Type Parameters

TFeatures

TFeatures extends TableFeatures

TData

TData extends RowData

Properties

autoResetCellSelection?

ts
optional autoResetCellSelection: boolean;

Defined in: features/cell-selection/cellSelectionFeature.types.ts:102

Resets cell selection to initialState.cellSelection whenever data changes. Defaults to true.

Ranges are stored as row and column ids, so new data would otherwise leave a selection pointing at rows that no longer exist, or silently re-select cells if the new data happens to reuse ids. Set to false to keep ranges across data changes, and note autoResetAll overrides this.


enableCellRangeSelection?

ts
optional enableCellRangeSelection: boolean;

Defined in: features/cell-selection/cellSelectionFeature.types.ts:107

Enables inclusive cell range selection through shift-click and drag. Defaults to true.


enableCellSelection?

ts
optional enableCellSelection: boolean | (cell) => boolean;

Defined in: features/cell-selection/cellSelectionFeature.types.ts:114

Allows cells to be selected.

Provide a predicate to decide per cell. A column def may also opt out with its own enableCellSelection: false. Defaults to true.


enableCellSelectionDrag?

ts
optional enableCellSelectionDrag: boolean;

Defined in: features/cell-selection/cellSelectionFeature.types.ts:119

Enables extending a selection by dragging across cells. Defaults to true.


enableMultiCellRangeSelection?

ts
optional enableMultiCellRangeSelection: boolean;

Defined in: features/cell-selection/cellSelectionFeature.types.ts:123

Allows modifier interactions to add or subtract ranges. Defaults to true.


isCellRangeSelectionEvent()?

ts
optional isCellRangeSelectionEvent: (event) => boolean;

Defined in: features/cell-selection/cellSelectionFeature.types.ts:131

Determines whether a selection-start event should extend the active range instead of replacing the selection.

By default, events with shiftKey directly on the event or on event.nativeEvent are treated as range-selection events.

Parameters

event

unknown

Returns

boolean


isMultiCellRangeSelectionEvent()?

ts
optional isMultiCellRangeSelectionEvent: (event) => boolean;

Defined in: features/cell-selection/cellSelectionFeature.types.ts:139

Determines whether a selection-start event should add or subtract a new rectangle. The operation depends on whether the starting cell is selected.

By default, events with ctrlKey or metaKey directly on the event or on event.nativeEvent are treated as multi-range events.

Parameters

event

unknown

Returns

boolean


onCellSelectionChange?

ts
optional onCellSelectionChange: OnChangeFn<CellSelectionState>;

Defined in: features/cell-selection/cellSelectionFeature.types.ts:148

Called with an updater when cell selection state changes. Pair this with state.cellSelection when using external state; external atoms can own the slice without this callback.

A drag emits one change per cell crossed. Subscribe to table.atoms.cellSelection for finer-grained reads when that matters.