ContextMenu
import {ContextMenu, openContextMenu} from 'cx/widgets';The ContextMenu widget is used for displaying menus on right-click events. The openContextMenu method
wraps the logic of positioning and opening the menu into a single call.
The openContextMenu method takes 3 arguments:
event: A context-menu event passed to the handler. Required.contents: Cx widget configuration. Usually a menu. Required.store: A store to be used inside the menu. Optional.
IndexGrid
<a href="#" onContextMenu={(e, {store}) => openContextMenu(e, <cx> <Menu> <a href="#">Action 1</a> <a href="#">Action 2</a> <Submenu arrow> Submenu <Menu putInto="dropdown"> <a href="#">Sub-Action 1</a> <a href="#">Sub-Action 2</a> </Menu> </Submenu> </Menu> </cx>, store)} > Right-click me </a>
Context-menus in Grids
Context menus are commonly used with grids (data-tables) to display additional actions for grid records.
| Name | Visits |
|---|---|
| Row 1 | 10 |
| Row 2 | 20 |
| Row 3 | 30 |
| Row 4 | 40 |
| Row 5 | 50 |