Skip to content

Methods

clearBorders

Source code

customBorders.clearBorders(selectionRanges)

Clear custom borders.

Example

const customBordersPlugin = hot.getPlugin('customBorders');
// Using an array of arrays (produced by `.getSelected()` method).
customBordersPlugin.clearBorders([[1, 1, 2, 2], [6, 2, 0, 2]]);
// Using an array of CellRange objects (produced by `.getSelectedRange()` method).
customBordersPlugin.clearBorders(hot.getSelectedRange());
// Using without param - clear all customBorders.
customBordersPlugin.clearBorders();
ParamTypeDescription
selectionRangesArray<Array>
Array<CellRange>
Array of selection ranges.

destroy

Source code

customBorders.destroy()

Destroys the plugin instance.

disablePlugin

Source code

customBorders.disablePlugin()

Disables the plugin functionality for this Handsontable instance.

enablePlugin

Source code

customBorders.enablePlugin()

Enables the plugin functionality for this Handsontable instance.

getBorders

Source code

customBorders.getBorders(selectionRanges) ⇒ Array<object>

Get custom borders.

Example

const customBordersPlugin = hot.getPlugin('customBorders');
// Using an array of arrays (produced by `.getSelected()` method).
customBordersPlugin.getBorders([[1, 1, 2, 2], [6, 2, 0, 2]]);
// Using an array of CellRange objects (produced by `.getSelectedRange()` method).
customBordersPlugin.getBorders(hot.getSelectedRange());
// Using without param - return all customBorders.
customBordersPlugin.getBorders();
ParamTypeDescription
selectionRangesArray<Array>
Array<CellRange>
Array of selection ranges.

Returns: Array<object> - Returns array of border objects.

isEnabled

Source code

customBorders.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 then the CustomBorders#enablePlugin method is called.

setBorders

Source code

customBorders.setBorders(selectionRanges, borderObject)

Set custom borders.

Example

const customBordersPlugin = hot.getPlugin('customBorders');
// Using an array of arrays (produced by `.getSelected()` method).
customBordersPlugin.setBorders([[1, 1, 2, 2], [6, 2, 0, 2]], {start: {width: 2, color: 'blue'}});
// Using an array of CellRange objects (produced by `.getSelectedRange()` method).
// Selecting a cell range.
hot.selectCell(0, 0, 2, 2);
// Returning selected cells' range with the getSelectedRange method.
customBordersPlugin.setBorders(hot.getSelectedRange(), {start: {hide: false, width: 2, color: 'blue'}});
ParamTypeDescription
selectionRangesArray<Array>
Array<CellRange>
Array of selection ranges.
borderObjectobjectObject with top, right, bottom and start properties.

updatePlugin

Source code

customBorders.updatePlugin()

Updates the plugin’s state.

This method is executed when updateSettings() is invoked with any of the following configuration options: