Cells

Cell Selection

LyteNyte Grid enables you to select individual cells or multiple cell ranges. Control selection behavior with the cellSelectionMode property in grid state, while the cellSelections property tracks which cells are currently selected.

Cell Selection Mode

Single Cell Selection

Set the cellSelectionMode to "single" to limit users to selecting only one cell at a time.

Single Cell Selection

Range

Set the cellSelectionMode to "range" to allow users to select a continuous range of cells. A range selection can be performed by clicking and dragging across cells

Range Cell Selection

Multi-Range

Set the cellSelectionMode to "multi-range" to enable selection of multiple separate cell ranges. Ranges may be added and remove programmatically, or whenever the user holds down the control key to select more ranges.

Multi Range Cell Selection

Managing Cell Selections

The cellSelections property in grid state maintains the current cell selection state. LyteNyte Grid represents each selection as a rectangle with starting and ending row indices and column indices.

From the grid's perspective, pinned rows are flattened into a single coordinate space. For example, if you pin two rows to the top, the first scrollable row will have an index of 2.

Retrieve Selected Data

Extract data from selected cells using the exportDataRect API method. This method accepts a rect object defining the cells to retrieve, making it perfect for working with cell selections. See the any data export guide for more details.