5.20231.904
wijmo.knockout.input Class wjContextMenu Wijmo API Class

wjContextMenu Class

KnockoutJS binding for context menus.

Use the wjContextMenu binding to add context menus to elements on the page. The wjContextMenu binding is based on the wjMenu; it displays a popup menu when the user performs a context menu request on an element (usually a right-click).

The wjContextMenu binding is specified as a parameter added to the element that the context menu applies to. The parameter value is a CSS selector for the element that contains the menu. For example:

<!-- paragraph with a context menu -->
<p data-bind="wjContextMenu: { id: '#idMenu'}" >
 This paragraph has a context menu.</p>

<!-- define the context menu (hidden and with an id) -->
<div id="contextmenu" data-bind="wjMenu: { header: 'File', itemClicked: menuItemClicked}">
    <span data-bind="wjMenuItem: {}">New</span>
    <span data-bind="wjMenuItem: {}">open an existing file or folder</span>
    <span data-bind="wjMenuItem: {}">save the current file</span>
    <span data-bind="wjMenuSeparator: {}"></span>
    <span data-bind="wjMenuItem: {}">exit the application</span>
</div>

Heirarchy

  • WjBinding
    • wjContextMenu