MergeCells

Plugin, which allows merging cells in the table (using the initial configuration, API or context menu).

Example
const hot = new Handsontable(document.getElementById('example'), {
 data: getData(),
 mergeCells: [
   {row: 0, col: 3, rowspan: 3, colspan: 3},
   {row: 2, col: 6, rowspan: 2, colspan: 2},
   {row: 4, col: 8, rowspan: 3, colspan: 3}
 ],

Classes

MergeCells

Methods

clearCollections()

Clears the merged cells from the merged cell container.

disablePlugin()

Disables the plugin functionality for this Handsontable instance.

enablePlugin()

Enables the plugin functionality for this Handsontable instance.

isEnabled(){boolean}

Checks if the plugin is enabled in the handsontable settings. This method is executed in Hooks#beforeInit
hook and if it returns true than the MergeCells#enablePlugin method is called.

Returns: {boolean}

merge(startRow, startColumn, endRow, endColumn)

Merges the specified range.

Parameters:
Name Type Description
startRow number

Start row of the merged cell.

startColumn number

Start column of the merged cell.

endRow number

End row of the merged cell.

endColumn number

End column of the merged cell.

Fires:

mergeSelection(cellRange)

Merges the selection provided as a cell range.

Parameters:
Name Type Description
cellRange CellRange optional

Selection cell range.

unmerge(startRow, startColumn, endRow, endColumn)

Unmerges the merged cell in the provided range.

Parameters:
Name Type Description
startRow number

Start row of the merged cell.

startColumn number

Start column of the merged cell.

endRow number

End row of the merged cell.

endColumn number

End column of the merged cell.

Fires:

unmergeSelection(cellRange)

Unmerges the selection provided as a cell range.

Parameters:
Name Type Description
cellRange CellRange optional

Selection cell range.

updatePlugin()

Updates the plugin state. This method is executed when Core#updateSettings is invoked.

Class: MergeCells