JavaScript Data Grid Context menu
Open a right-click context menu to access contextual actions such as removing rows, inserting columns, or copying data to the clipboard.
In this article
Context menu with default options
To run the basic configuration of the Context Menu, just set the contextMenu
option to true
.
Context menu with specific options
You can define items in the menu by passing the 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 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
Related keyboard shortcuts
Windows | macOS | Action | Excel | Sheets |
---|---|---|---|---|
Arrow keys | Arrow keys | Move one available menu item up, down, left, or right | ✓ | ✓ |
Page Up | Page Up | Move to the first visible item of the context menu or submenu | ✓ | ✗ |
Page Down | Page Down | Move to the last visible item of the context menu or submenu | ✓ | ✗ |
Escape | Escape | Close the context menu or submenu | ✓ | ✓ |
Enter | Enter | Run the action of the selected menu item | ✓ | ✗ |
Related articles
Related guides
- Adding comments via the context menu
- Clipboard: Context menu
- Icon pack
- Custom context menu in React
- Custom context menu in Angular
- Custom context menu in Vue 2
- Custom context menu in Vue 3
Related blog articles
Related API reference
- Configuration options:
- Hooks:
- Plugins: