Documentation

Report Edit

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>
Copied!Cx Fiddle

Context-menus in Grids

Context menus are commonly used with grids (data-tables) to display additional actions for grid records.

NameVisits
Row 110
Row 220
Row 330
Row 440
Row 550