This page covers a next version of Handsontable, and is not published yet.

This page covers a non-latest version of Handsontable.

# CellRange

# Members

# from

Source code (opens new window)

cellRange.from : CellCoords

Usually the same as highlight, but in Excel there is distinction - one can change highlight within a selection.

# highlight

Source code (opens new window)

cellRange.highlight : CellCoords

Used to draw bold border around a cell where selection was started and to edit the cell when you press Enter. The highlight cannot point to headers (negative values) so its coordinates object is normalized while assigning.

# to

Source code (opens new window)

cellRange.to : CellCoords

End selection.

# Methods

# clone

Source code (opens new window)

cellRange.clone() ⇒ CellRange

Clones the range coordinates.

# expand

Source code (opens new window)

cellRange.expand(cellCoords) ⇒ boolean

Adds a cell to a range (only if exceeds corners of the range). Returns information if range was expanded.

Param Type Description
cellCoords CellCoords The cell coordinates.

# expandByRange

Source code (opens new window)

cellRange.expandByRange(expandingRange) ⇒ boolean

Expand the current object by the range passed in the first argument.

Param Type Description
expandingRange CellRange Object extending the range.

# flipDirectionHorizontally

Source code (opens new window)

cellRange.flipDirectionHorizontally()

Flip the direction horizontally. (e.g. NW-SE changes to NE-SW).

# flipDirectionVertically

Source code (opens new window)

cellRange.flipDirectionVertically()

Flip the direction vertically. (e.g. NW-SE changes to SW-NE).

# forAll

Source code (opens new window)

cellRange.forAll(callback)

Runs a callback function against all cells in the range. You can break the iteration by returning false in the callback function.

Param Type Description
callback function The callback function.

# getAll

Source code (opens new window)

cellRange.getAll() ⇒ Array

Get all selected cell coords defined by this range.

# getBordersSharedWith

Source code (opens new window)

cellRange.getBordersSharedWith(range) ⇒ Array

Param Type Description
range CellRange The cells range to compare with.

# getBottomEndCorner

Source code (opens new window)

cellRange.getBottomEndCorner() ⇒ CellCoords

Gets the bottom right (in LTR) or bottom left (in RTL) corner coordinates of this range. If the corner contains header coordinates (negative values), the corner coordinates will be normalized to 0.

# getBottomLeftCorner

Source code (opens new window)

cellRange.getBottomLeftCorner() ⇒ CellCoords

Gets the bottom left corner coordinates of this range, no matter if the code runs in LTR or RTL document mode. If the corner contains header coordinates (negative values), the corner coordinates will be normalized to 0.

# getBottomRightCorner

Source code (opens new window)

cellRange.getBottomRightCorner() ⇒ CellCoords

Gets the bottom right corner coordinates of this range, no matter if the code runs in LTR or RTL document mode. If the corner contains header coordinates (negative values), the corner coordinates will be normalized to 0.

# getBottomStartCorner

Source code (opens new window)

cellRange.getBottomStartCorner() ⇒ CellCoords

Gets the bottom left (in LTR) or bottom right (in RTL) corner coordinates of this range. If the corner contains header coordinates (negative values), the corner coordinates will be normalized to 0.

# getCellsCount

Source code (opens new window)

cellRange.getCellsCount() ⇒ number

Returns the number of cells within the range (excluding the column and row headers, if selected).

# getDirection

Source code (opens new window)

cellRange.getDirection() ⇒ string

Gets the direction of the selection.

Returns: string - Returns one of the values: 'NW-SE', 'NE-SW', 'SE-NW', 'SW-NE'.

# getHeight

Source code (opens new window)

cellRange.getHeight() ⇒ number

Returns selected range height (in number of rows excluding rows' headers).

# getHorizontalDirection

Source code (opens new window)

cellRange.getHorizontalDirection() ⇒ string

Gets the horizontal direction of the range.

Returns: string - Returns one of the values: W-E (west->east), E-W (east->west).

# getInner

Source code (opens new window)

cellRange.getInner() ⇒ Array

Get inner selected cell coords defined by this range.

# getOppositeCorner

Source code (opens new window)

cellRange.getOppositeCorner(coords, [expandedRange]) ⇒ CellCoords

Gets coordinates of the corner which is opposite to the matched. When the passed coordinates matched to the bottom-right corner of this range then the coordinates for top-left will be returned.

Param Type Description
coords CellCoords Cell coordinates to check.
[expandedRange] CellRange optional The cells range to compare with.

# getOuterBottomEndCorner

Source code (opens new window)

cellRange.getOuterBottomEndCorner() ⇒ CellCoords

Gets the bottom right (in LTR) or bottom left (in RTL) corner coordinates of this range. If the corner contains header coordinates (negative values), then the top and start coordinates will be pointed to that header.

# getOuterBottomLeftCorner

Source code (opens new window)

cellRange.getOuterBottomLeftCorner() ⇒ CellCoords

Gets the bottom left corner coordinates of this range, no matter if the code runs in LTR or RTL document mode. If the corner contains header coordinates (negative values), then the top and left coordinates will be pointed to that header.

# getOuterBottomRightCorner

Source code (opens new window)

cellRange.getOuterBottomRightCorner() ⇒ CellCoords

Gets the bottom right corner coordinates of this range, no matter if the code runs in LTR or RTL document mode. If the corner contains header coordinates (negative values), then the top and left coordinates will be pointed to that header.

# getOuterBottomStartCorner

Source code (opens new window)

cellRange.getOuterBottomStartCorner() ⇒ CellCoords

Gets the bottom left (in LTR) or bottom right (in RTL) corner coordinates of this range. If the corner contains header coordinates (negative values), then the top and start coordinates will be pointed to that header.

# getOuterHeight

Source code (opens new window)

cellRange.getOuterHeight() ⇒ number

Returns selected range height (in number of rows including rows' headers).

# getOuterTopEndCorner

Source code (opens new window)

cellRange.getOuterTopEndCorner() ⇒ CellCoords

Gets the top right (in LTR) or top left (in RTL) corner coordinates of this range. If the corner contains header coordinates (negative values), then the top and start coordinates will be pointed to that header.

# getOuterTopLeftCorner

Source code (opens new window)

cellRange.getOuterTopLeftCorner() ⇒ CellCoords

Gets the top left corner coordinates of this range, no matter if the code runs in LTR or RTL document mode. If the corner contains header coordinates (negative values), then the top and left coordinates will be pointed to that header.

# getOuterTopRightCorner

Source code (opens new window)

cellRange.getOuterTopRightCorner() ⇒ CellCoords

Gets the top right corner coordinates of this range, no matter if the code runs in LTR or RTL document mode. If the corner contains header coordinates (negative values), then the top and left coordinates will be pointed to that header.

# getOuterTopStartCorner

Source code (opens new window)

cellRange.getOuterTopStartCorner() ⇒ CellCoords

Gets the top left (in LTR) or top right (in RTL) corner coordinates of this range. If the corner contains header coordinates (negative values), then the top and start coordinates will be pointed to that header.

# getOuterWidth

Source code (opens new window)

cellRange.getOuterWidth() ⇒ number

Returns selected range width (in number of columns including columns' headers).

# getTopEndCorner

Source code (opens new window)

cellRange.getTopEndCorner() ⇒ CellCoords

Gets the top right (in LTR) or top left (in RTL) corner coordinates of this range. If the corner contains header coordinates (negative values), the corner coordinates will be normalized to 0.

# getTopLeftCorner

Source code (opens new window)

cellRange.getTopLeftCorner() ⇒ CellCoords

Gets the top left corner coordinates of this range, no matter if the code runs in LTR or RTL document mode. If the corner contains header coordinates (negative values), the corner coordinates will be normalized to 0.

# getTopRightCorner

Source code (opens new window)

cellRange.getTopRightCorner() ⇒ CellCoords

Gets the top right corner coordinates of this range, no matter if the code runs in LTR or RTL document mode. If the corner contains header coordinates (negative values), the corner coordinates will be normalized to 0.

# getTopStartCorner

Source code (opens new window)

cellRange.getTopStartCorner() ⇒ CellCoords

Gets the top left (in LTR) or top right (in RTL) corner coordinates of this range. If the corner contains header coordinates (negative values), the corner coordinates will be normalized to 0.

# getVerticalDirection

Source code (opens new window)

cellRange.getVerticalDirection() ⇒ string

Gets the vertical direction of the range.

Returns: string - Returns one of the values: N-S (north->south), S-N (south->north).

# getWidth

Source code (opens new window)

cellRange.getWidth() ⇒ number

Returns selected range width (in number of columns excluding columns' headers).

# includes

Source code (opens new window)

cellRange.includes(cellCoords) ⇒ boolean

Checks if given cell coordinates are within from and to cell coordinates of this range.

Param Type Description
cellCoords CellCoords The cell coordinates to check.

# includesRange

Source code (opens new window)

cellRange.includesRange(cellRange) ⇒ boolean

Checks if given range is within of this range.

Param Type Description
cellRange CellRange The cells range to check.

# isCorner

Source code (opens new window)

cellRange.isCorner(coords, [expandedRange]) ⇒ boolean

Checks if coordinates match to one of the 4th corners of this range.

Param Type Description
coords CellCoords Cell coordinates to check.
[expandedRange] CellRange optional The cells range to compare with.

# isEqual

Source code (opens new window)

cellRange.isEqual(cellRange) ⇒ boolean

Checks if given range is equal to this range.

Param Type Description
cellRange CellRange The cells range to check.

# isNorthWestOf

Source code (opens new window)

cellRange.isNorthWestOf(cellRange) ⇒ boolean

Checks if tested coordinates are positioned in north-west from this cell range.

Param Type Description
cellRange CellRange The cells range to check.

# isOverlappingHorizontally

Source code (opens new window)

cellRange.isOverlappingHorizontally(cellRange) ⇒ boolean

Returns true if the provided range is overlapping the current range horizontally (e.g. The current range's last column is 5 and the provided range's first column is 3).

Param Type Description
cellRange CellRange The cells range to check.

# isOverlappingVertically

Source code (opens new window)

cellRange.isOverlappingVertically(cellRange) ⇒ boolean

Returns true if the provided range is overlapping the current range vertically (e.g. The current range's last row is 5 and the provided range's first row is 3).

Param Type Description
cellRange CellRange The cells range to check.

# isSingle

Source code (opens new window)

cellRange.isSingle() ⇒ boolean

Checks if this cell range is restricted to one cell.

# isSouthEastOf

Source code (opens new window)

cellRange.isSouthEastOf(cellRange) ⇒ boolean

Checks if tested coordinates are positioned in south-east from this cell range.

Param Type Description
cellRange CellRange The cells range to check.

# isValid

Source code (opens new window)

cellRange.isValid(wot) ⇒ boolean

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

Param Type Description
wot Walkontable The Walkontable instance.

# overlaps

Source code (opens new window)

cellRange.overlaps(cellRange) ⇒ boolean

Checks if tested range overlaps with the range. Range A is considered to to be overlapping with range B if intersection of A and B or B and A is not empty.

Param Type Description
cellRange CellRange The cells range to check.

# setDirection

Source code (opens new window)

cellRange.setDirection(direction)

Sets the direction of the selection.

Param Type Description
direction string One of the values: 'NW-SE', 'NE-SW', 'SE-NW', 'SW-NE'.

# setFrom

Source code (opens new window)

cellRange.setFrom(coords) ⇒ CellRange

Set the new coordinates where selection starts from.

Param Type Description
coords CellCoords Coordinates to use.

# setHighlight

Source code (opens new window)

cellRange.setHighlight(coords) ⇒ CellRange

Set the new coordinates for highlighting selection.

Param Type Description
coords CellCoords Coordinates to use.

# setTo

Source code (opens new window)

cellRange.setTo(coords) ⇒ CellRange

Set new coordinates where selection ends from.

Param Type Description
coords CellCoords Coordinates to use.

# toObject

Source code (opens new window)

cellRange.toObject() ⇒ object

Convert CellRange to literal object.

Returns: object - Returns a literal object with from and to properties which each of that object contains row and col keys.

Last Updated: Apr 19, 2024