Default context menu options
The following example demonstrates a basic setup of content menu. To run the basic configuration, just set the contextMenu
option to true
. When the context menu for the row header is opened, the column options are disabled. Likewise, when the context menu for the column header is opened, the row options are disabled.
Specific options
You can limit options available in the context menu using contextMenu
option as an array of strings: row_above
- insert row above; row_below
- insert row below; col_left
- insert column on the left; col_right
- insert column on the right; remove_row
- remove row; remove_col
- remove column; undo
- undo action; redo
- redo action; make_read_only
- read only; alignment
- submenu with alignment options. For separator use '---------'
string.
Custom configuration
The following example demonstrates custom context menu configuration. For greatest configurability, you use contextMenu
option as a configuration object as described in jQuery contextMenu documentation. This example shows how to set custom text, how to disable "Remove row" and "Insert row above" for the first row and how to add your own option.
Copy-paste configuration
Copy and Paste feature are available in Handsontable by default, but only as key shortcuts (Ctrl (Cmd) + C and Ctrl (Cmd) + V respectively). This plugin makes them available also as a clickable options in the context menu. Unfortunately, due to the browser's security restrictions, Handsontable is forced to use a third-party SheetClip library - a tiny library that transforms JavaScript 2-dimensional arrays to clipboard strings compatible with spreadsheets such as Microsoft Excel, Google Docs, LibreOffice and OpenOffice.