MergedCellsCollection

Defines a container object for the merged cells.

Members

The Handsontable instance.

mergedCellsArray

Array of merged cells.

pluginMergeCells

Reference to the Merge Cells plugin.

Methods

staticMergedCellsCollection.IS_OVERLAPPING_WARNING(newMergedCell){string}

Get a warning message for when the declared merged cell data overlaps already existing merged cells.

Parameters:
Name Type Description
newMergedCell object

Object containg information about the merged cells that was about to be added.

Returns: {string}

add(mergedCellInfo){MergedCellCoords|boolean}

Add a merged cell to the container.

Parameters:
Name Type Description
mergedCellInfo object

The merged cell information object. Has to contain row, col, colspan and rowspan properties.

Returns: {MergedCellCoords|boolean} Returns the new merged cell on success and false on failure.

clear()

Clear all the merged cells.

get(row, column){MergedCellCoords|boolean}

Get a merged cell from the container, based on the provided arguments. You can provide either the "starting coordinates"
of a merged cell, or any coordinates from the body of the merged cell.

Parameters:
Name Type Description
row number

Row index.

column number

Column index.

Returns: {MergedCellCoords|boolean} Returns a wanted merged cell on success and false on failure.

getByRange(range){MergedCellCoords|boolean}

Get a merged cell containing the provided range.

Parameters:
Name Type Description
range CellRange | object

The range to search merged cells for.

Returns: {MergedCellCoords|boolean}

getFirstRenderableCoords(row, column){CellCoords}

Get the first renderable coords of the merged cell at the provided coordinates.

Parameters:
Name Type Description
row number

Visual row index.

column number

Visual column index.

Returns: {CellCoords} A CellCoords object with the coordinates to the first renderable cell within the
merged cell.

getWithinRange(range, countPartials){Array|boolean}

Get a merged cell contained in the provided range.

Parameters:
Name Type Default Description
range CellRange | object

The range to search merged cells in.

countPartials boolean false optional

If set to true, all the merged cells overlapping the range will be taken into calculation.

Returns: {Array|boolean} Array of found merged cells of false if none were found.

isFirstRenderableMergedCell(row, column){boolean}

Check whether the provided row/col coordinates direct to a first not hidden cell within merge area.

Parameters:
Name Type Description
row number

Visual row index.

column number

Visual column index.

Returns: {boolean}

isOverlapping(mergedCell){boolean}

Check if the provided merged cell overlaps with the others in the container.

Parameters:
Name Type Description
mergedCell MergedCellCoords

The merged cell to check against all others in the container.

Returns: {boolean} true if the provided merged cell overlaps with the others, false otherwise.

remove(row, column){MergedCellCoords|boolean}

Remove a merged cell from the container. You can provide either the "starting coordinates"
of a merged cell, or any coordinates from the body of the merged cell.

Parameters:
Name Type Description
row number

Row index.

column number

Column index.

Returns: {MergedCellCoords|boolean} Returns the removed merged cell on success and false on failure.

shiftCollections(direction, index, count)

Shift the merged cell in the direction and by an offset defined in the arguments.

Parameters:
Name Type Description
direction string

right, left, up or down.

index number

Index where the change, which caused the shifting took place.

count number

Number of rows/columns added/removed in the preceding action.

Class: MergedCellsCollection