CellCoords
Plugin: 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 modulesimport Handsontable, { CellCoords } from '/handsontable/base';Members
col
cellCoords.col : number
A visual column index.
row
cellCoords.row : number
A visual row index.
Methods
assign
cellCoords.assign(coords) ⇒ CellCoords
Assigns the coordinates from another CellCoords instance (or compatible literal object)
to your CellCoords instance.
| Param | Type | Description |
|---|---|---|
| coords | CellCoords Object | The CellCoords instance or compatible literal object. |
clone
cellCoords.clone() ⇒ CellCoords
Clones your CellCoords instance.
isCell
cellCoords.isCell() ⇒ boolean
Checks if the coordinates point to the cells range. If all axis (row and col) point to
the cell (positive value) then method returns true.
isEqual
cellCoords.isEqual(coords) ⇒ boolean
Checks if another set of coordinates (coords)
is equal to the coordinates in your CellCoords instance.
| Param | Type | Description |
|---|---|---|
| coords | CellCoords | Coordinates to check. |
isHeader
cellCoords.isHeader() ⇒ boolean
Checks if the coordinates point to the headers range. If one of the axis (row or col) point to
the header (negative value) then method returns true.
isNorthEastOf
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
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. |
isRtl
cellCoords.isRtl() ⇒ boolean
Checks if the coordinates runs in RTL mode.
isSouthEastOf
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
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
cellCoords.isValid([tableParams]) ⇒ boolean
Checks if the coordinates in your CellCoords instance are valid
in the context of given table parameters.
The row index:
- Must be an integer.
- Must be higher than the number of column headers in the table.
- Must be lower than the total number of rows in the table.
The col index:
- Must be an integer.
- Must be higher than the number of row headers in the table.
- Must be lower than the total number of columns in the table.
| Param | Type | Default | Description |
|---|---|---|---|
| [tableParams] | object | optional An object with a defined table size. | |
| [tableParams.countRows] | number | 0 | optional The total number of rows. |
| [tableParams.countCols] | number | 0 | optional The total number of columns. |
| [tableParams.countRowHeaders] | number | 0 | optional A number of row headers. |
| [tableParams.countColHeaders] | number | 0 | optional A number of column headers. |
Returns: boolean - true: The coordinates are valid.
normalize
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
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.