Class: ContextMenu

ContextMenu

handsontable/src/plugins/contextMenu/contextMenu.js, line 53

This plugin creates the Handsontable Context Menu. It allows to create a new row or
column at any place in the grid among other features.
Possible values:

  • true (to enable default options),
  • false (to disable completely)

or array of any available strings:

  • ["row_above", "row_below", "col_left", "col_right", "remove_row", "remove_col", "---------", "undo", "redo"].

See the context menu demo for examples.

Example
...
// as a boolean
contextMenu: true
...
// as a array
contextMenu: ['row_above', 'row_below', '--------', 'undo', 'redo']
...

Members

staticContextMenu.DEFAULT_ITEMS

Default menu items order when contextMenu is enabled by true.

commandExecutorCommandExecutor

Instance of CommandExecutor.

eventManagerEventManager

Instance of EventManager.

itemsFactoryItemsFactory

Instance of ItemsFactory.

Instance of Menu.

Methods

handsontable/src/plugins/contextMenu/contextMenu.js, line 205

close()

Close menu.

handsontable/src/plugins/contextMenu/contextMenu.js, line 293

destroy()

Destroy instance.

handsontable/src/plugins/contextMenu/contextMenu.js, line 163

disablePlugin()

Disable plugin for this Handsontable instance.

handsontable/src/plugins/contextMenu/contextMenu.js, line 115

enablePlugin()

Enable plugin for this Handsontable instance.

handsontable/src/plugins/contextMenu/contextMenu.js, line 238

executeCommand(commandName, params)

Execute context menu command.

You can execute all predefined commands:

  • 'row_above' - Insert row above
  • 'row_below' - Insert row below
  • 'col_left' - Insert column on the left
  • 'col_right' - Insert column on the right
  • 'clear_column' - Clear selected column
  • 'remove_row' - Remove row
  • 'remove_col' - Remove column
  • 'undo' - Undo last action
  • 'redo' - Redo last action
  • 'make_read_only' - Make cell read only
  • 'alignment:left' - Alignment to the left
  • 'alignment:top' - Alignment to the top
  • 'alignment:right' - Alignment to the right
  • 'alignment:bottom' - Alignment to the bottom
  • 'alignment:middle' - Alignment to the middle
  • 'alignment:center' - Alignment to the center (justify)

Or you can execute command registered in settings where key is your command name.

Parameters:
Name Type Description
commandName String
params *
handsontable/src/plugins/contextMenu/contextMenu.js, line 108

isEnabled(){Boolean}

Check if the plugin is enabled in the Handsontable settings.

Returns: {Boolean}
handsontable/src/plugins/contextMenu/contextMenu.js, line 187

open(event)

Open menu and re-position it based on dom event object.

Parameters:
Name Type Description
event Event

The event object.

handsontable/src/plugins/contextMenu/contextMenu.js, line 153

updatePlugin()

Updates the plugin to use the latest options you have specified.