React Data Grid CellCoords

Description

The CellCoords class holds the coordinates (row, col) of a single cell.

It also contains methods for validating the coordinates and retrieving them as an object.

To import the CellCoords class:

import Handsontable, { CellCoords } from '/handsontable';

// or, using modules
import Handsontable, { CellCoords } from '/handsontable/base';

Members

col

Source code (opens new window)

cellCoords.col : number

A visual column index.

row

Source code (opens new window)

cellCoords.row : number

A visual row index.

Methods

clone

Source code (opens new window)

cellCoords.clone() ⇒ CellCoords

Clones your CellCoords instance.

isEqual

Source code (opens new window)

cellCoords.isEqual(cellCoords) ⇒ boolean

Checks if another set of coordinates (cellCoords) is equal to the coordinates in your CellCoords instance.

Param Type Description
cellCoords CellCoords Coordinates to check.

isNorthEastOf

Source code (opens new window)

cellCoords.isNorthEastOf(testedCoords) ⇒ boolean

Checks if another set of coordinates (testedCoords) is north-east of the coordinates in your CellCoords instance.

Param Type Description
testedCoords CellCoords Coordinates to check.

isNorthWestOf

Source code (opens new window)

cellCoords.isNorthWestOf(testedCoords) ⇒ boolean

Checks if another set of coordinates (testedCoords) is north-west of the coordinates in your CellCoords instance.

Param Type Description
testedCoords CellCoords Coordinates to check.

isSouthEastOf

Source code (opens new window)

cellCoords.isSouthEastOf(testedCoords) ⇒ boolean

Checks if another set of coordinates (testedCoords) is south-east of the coordinates in your CellCoords instance.

Param Type Description
testedCoords CellCoords Coordinates to check.

isSouthWestOf

Source code (opens new window)

cellCoords.isSouthWestOf(testedCoords) ⇒ boolean

Checks if another set of coordinates (testedCoords) is south-west of the coordinates in your CellCoords instance.

Param Type Description
testedCoords CellCoords Coordinates to check.

isValid

Source code (opens new window)

cellCoords.isValid(wot) ⇒ boolean

Checks if the coordinates in your CellCoords instance are valid in the context of a given Walkontable instance.

The row index:

  • Can't be negative.
  • Can't be higher than the total number of rows in the Walkontable instance.

The col index:

  • Can't be negative.
  • Can't be higher than the total number of columns in the Walkontable instance.
Param Type Description
wot Walkontable A Walkontable instance.

Returns: boolean - true: The coordinates are valid.

normalize

Source code (opens new window)

cellCoords.normalize() ⇒ CellCoords

Normalizes the coordinates in your CellCoords instance to the nearest valid position.

Coordinates that point to headers (negative values) are normalized to 0.

toObject

Source code (opens new window)

cellCoords.toObject() ⇒ Object

Converts your CellCoords instance into an object literal with row and col properties.

Returns: Object - An object literal with row and col properties.

Last update: Nov 20, 2024