Tutorial: Context menu

Context menu

Context menu with default options

To run the basic configuration of the Context Menu, just set the contextMenu option to true.

From version 0.11, context menu also works for row and column headers. 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

Context menu with specific options

You can limit options available in the context menu using contextMenu option as an array of keys which are strings:

Key Purpose Extra conditions
row_above Insert row above action
row_below Insert row below action
col_left Insert column left action
col_right Insert column right action
--------- Separator
remove_row Remove row(s) actions
remove_col Remove column(s) action
clear_column Clear column values action
undo Undo action Plugin UndoRedo turned on
redo Redo action Plugin UndoRedo turned on
make_read_only Make read only action
alignment Alignment actions
cut Cut action Plugin CopyPaste turned on
copy Copy action Plugin CopyPaste turned on
freeze_column Freeze column action Plugin ManualColumnFreeze turned on
unfreeze_column Unfreeze column action Plugin ManualColumnFreeze turned on
borders Custom borders actions Plugin CustomBorders turned on
commentsAddEdit Add and edit comment actions Plugin Comments turned on
commentsRemove Remove comment action Plugin Comments turned on
commentsReadOnly Make comment read only action Plugin Comments turned on
mergeCells Merge and unmerge cells actions Plugin MergeCells turned on
add_child Insert child row action Plugin NestedRows turned on
detach_from_parent Detach from parent row action Plugin NestedRows turned on
hidden_columns_hide Hide column(s) action Plugin HiddenColumns turned on
hidden_columns_show Show hidden column(s) action Plugin HiddenColumns turned on
hidden_rows_hide Hide row(s) action Plugin HiddenRows turned on
hidden_rows_show Show hidden row(s) action Plugin HiddenRows turned on
filter_by_condition First conditions select element Plugin Filters turned on
filter_operators Operation select element Plugin Filters turned on
filter_by_condition2 Second conditions select element Plugin Filters turned on
filter_by_value Value select element Plugin Filters turned on
filter_action_bar Action bar element Plugin Filters turned on

Context menu with fully custom configuration

This example shows how to:

  • add common callback for all options
  • dynamically disable option
  • set custom text for predefined option
  • add own custom option
  • add callback for specific option

Help us improve this page