Protected allThis is a flag to indicate whether all cells in the grid are selected or not.
Protected negativeThis contains all the current negative cell ranges in the grid.
Protected rangesThis contains all the current selected cell ranges in the grid.
The mode of selection being used. It's of type SelectionMode. Default: "single"
The type of selection being used. It's of type ExtendedSelectionType. Default: "none"
Protected silentThis is a flag to suppress the firing of selection change events.
Get notified on every change of the selection.
Protected addAdds a rectangle to the selection (adjusted to the selection type: whole rows for "row", whole columns for
"column", the first cell for "cell"). Cells of the rectangle that were deselected before
(removeSelection) are selected again – the last operation wins.
the cells to select (adjusted in place to the selection type)
Protected adjustA copy of the current selection state, e.g. to restore it while a drag rectangle changes (see restoreSnapshot). The ranges themselves are shared – they are never changed after being added.
the state
The registered listeners (the table registers itself).
The indices of all rows that contain at least one selected cell, sorted ascending and without duplicates. A row whose selected cells were all removed again (removeSelection) is left out.
Ranges that cover all rows (selection type "column", CellRange.singleColumn: r2 = Number.MAX_SAFE_INTEGER)
and selectAll can only be resolved with rowCount. Without it they are skipped (before, such a range
made this method loop forever) – pass the number of (displayed) body rows to get them, too.
Optional rowCount: numbernumber of body rows; rows >= rowCount are left out, and "all rows"
(column ranges, selectAll) becomes 0 … rowCount - 1
row indices, sorted ascending
const rowCount = tableModel.getBodyModel().getRowCount();
const rowIndices = selectionModel.getMergedRowIndices(rowCount); // e.g. [1, 2, 5]
console.log(`${rowIndices.length} rows with selected cells`);
Retrieves the selected rows from an array of all table rows. The selection holds row indices of the displayed rows – pass the displayed (filtered, sorted) rows.
The array of all rows from the table model.
Was everything selected with selectAll?
Protected liftRemoves the cells of range from all negative ranges ("last operation wins": cells added after they were
removed are selected again). A negative range that overlaps range is split into up to four rectangles
(above, below, left and right of the overlap); unbounded ranges (Number.MAX_SAFE_INTEGER) work as well.
the cells that are selected again
Stop notifications.
Deselects a rectangle (stored as a "negative" range, so it also cuts holes into selectAll).
For selection type "row" all rows r1 … r2 are removed, for "column" all columns c1 … c2.
A following addSelection / togglePoint of these cells selects them again.
the cells to deselect
Protected reselectSelects a deselected cell again ("toggle on") by lifting the negative ranges at this cell (for selection type
"row"/"column": at its whole row/column) – only possible while the cell is still inside a selected range
or everything is selected. Fires no event.
row index
column index
true if the cell is selected again, false if it has to be added as a new range
Restores a state created by createSnapshot (fires a change event).
the state to restore
Selects all cells. Cells that were deselected before (removeSelection) are selected again; removing cells afterwards cuts holes into "all selected".
Toggles the selection state of a cell (for selection type "row"/"column": of its row/column).
A cell that was deselected inside a selected range (or after selectAll) gets selected again
without adding a second, overlapping range.
row index
column index
Class representing a multi-row selection model.