CellSelector
Description
The CellSelector is responsible for anything related to your cell selection inside your DataGridXL instance. It is bound to a Sheet instance.
Usage
Your DataGridXL instance contains a property cellSelector.
// create DataGridXL instance
const grid = new DataGridXL(...);
// work with the CellSelector instance
grid.cellSelector.selectAll();
grid.cellSelector.events.on('change', ...);NOTE: You don't need to create a CellSelector instance yourself — it is provided by the grid automatically.Methods
addCellRangeToSelection(cellRange)Add cell range to selection
Arguments
CellRange$changeaddColRangeToSelection(colRange, cellCursorRowCoord?)Add column range to selection
Arguments
ColRangeColumn rangeRowCoorddefault 0Row coordinate of cell cursor$changeaddRowRangeToSelection(rowRange, cellCursorColCoord?)Add row range to selection
Arguments
RowRangeColCoorddefault 0Column coordinate of cell cursor$changeclear()Clear any selection
$changegetActiveSelectionRange(): SelectionRangeThe current active selection range
SelectionRangegetCellCursorPosition(): CellCoordsThe current cell cursor position
CellCoordsCell coordinates of cell cursorgetColTypeSelectionRanges(colCoord?): array<SelectionRange>All selection ranges of type `col` Pass a column coordinate to only return selection ranges that span the given column
Arguments
ColCoorddefault nullColumn Coordinatearray<SelectionRange>List of selection rangesgetRowTypeSelectionRanges(rowCoord?): array<SelectionRange>All selection ranges of type `row` Pass a row coordinate to only return selection ranges that span the given row
Arguments
RowCoorddefault nullRow Coordinatearray<SelectionRange>List of selection rangesgetSelectedColRanges(): array<ColRange>All column ranges in current selection
array<ColRange>getSelectedRowRanges(): array<RowRange>All row ranges in current selection
array<RowRange>getSelection(): array<SelectionRange>The current selection
array<SelectionRange>List of selection rangesgetState(): objectThe current state of the cell selector
object{ selection, cellCursorPosition, activeRangeIndex }isCellSelected(cellCoords): booleanCheck if a particular cell is selected
Arguments
CellCoordsbooleanisColSelected(colCoord): booleanCheck if a particular column is selected
Arguments
ColCoordbooleanisRowSelected(rowCoord): booleanCheck if a particular row is selected
Arguments
RowCoordbooleanisSet(): booleanCheck if cell selector is set
booleanmodifyActiveSelectionRange(direction)Modify (expand or shrink) active selection range in given direction
Arguments
stringup, right, bottom, left$changemoveCellCursor(mutationCoords)Move cell cursor by `{x,y}` mutation
Arguments
CellCoordsmoveCellCursorAroundSelection(mutationCoords)Move cell cursor by `{x,y}` mutation
Arguments
CellCoordsmoveCellCursorToColEnd()Move cell cursor to the last cell of the current column
moveCellCursorToColStart()Move cell cursor to the first cell of the current column
moveCellCursorToRowEnd()Move cell cursor to the last cell of the current row
moveCellCursorToRowStart()Move cell cursor to the first cell of the current row
moveCellCursorToSheetEnd()Moves cell cursor to the last cell of the sheet
moveCellCursorToSheetStart()Moves cell cursor to the first cell of the sheet
selectAll(cellCursorPosition?)Select all cells in the sheet
Arguments
CellCoordscellCursorPositionselectCol(colCoord, cellCursorRowCoord?)Select a single column
Arguments
ColCoordCoordinate of column to selectRowCoorddefault 0Row coordinate of cell cursor$changeselectRow(rowCoord, cellCursorColCoord?)Select a single row
Arguments
RowCoordCoordinate of row to selectColCoordColumn coordinate of cell cursor$changesetCellCursorPosition(cellCoords)Set cell cursor position at specific coordinates
Arguments
CellCoordsCell CoordinatessetCellRangeExtreme(cellCoords, keepMultiSelection?)Set extreme of cell range to given cell coordinates
Arguments
CellCoordsbooleandefault falseKeep or clear multi selection$changesetColRangeExtreme(colCoord, keepMultiSelection?)Set extreme of column range to given column coordinate
Arguments
ColCoordbooleandefault falseKeep or clear multi selection$changesetRowRangeExtreme(rowCoord, keepMultiSelection?)Set extreme of row range to given row coordinate
Arguments
RowCoordbooleandefault falseKeep or clear multi selection$changesetState(state)Set state with { selection, cellCursorPosition, activeRangeIndex }
Arguments
object$changeEvents
beforechangeCellSelectorChangeEventPayload
typestringtargetCellSelectorpayloadCellSelectorChangeEventPayloadchangeCellSelectorChangeEventPayload
typestringtargetCellSelectorpayloadCellSelectorChangeEventPayload