Class: MergedCellsCollection

MergedCellsCollection

Defines a container object for the merged cells.

Members

hotHandsontable

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}

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 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.

isMergedParent(row, column){Boolean}

Check whether the provided row/col coordinates direct to a merged parent.

Parameters:
Name Type Description
row Number

Row index.

column Number

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.