Members
-
<constant> ContextMenuItemTypes
-
Possible ContextMenuItem types
- Source:
Properties:
Name Type Default Description simpleThe command is a simple clickable item.
texttext Makes the command an <input> of type text. The name followed by the <input> are encapsulated in a <label>.
textareatextarea Makes the command a <textarea>. The name followed by the <textarea> are encapsulated in a <label>.
checkboxcheckbox Makes the command an <input> of type checkbox. The name followed by the <input> are encapsulated in a <label>.
radioradio Makes the command an <input> of type radio. The name followed by the <input> are encapsulated in a <label>.
selectselect Makes the command aa <select>. The name followed by the <select> are encapsulated in a <label>.
htmlhtml Makes an non-command element. When you select
type: 'html'add the html to the html property. So:{ item: { type: 'html', html: '<span>html!</span>' } }. You can also just use the item name with theisHtmlNameproperty.separatorcm_separator Internal property, used internally when the type is set to a string.
submenusub Internal property for a ContextMenuItem that has an
itemsproperty with other ContextMenuItem items.
Type Definitions
-
ContextMenuBuildCallback(e, $currentTrigger)
-
Parameters:
Name Type Description eJQuery.Event Event that trigged the menu.
$currentTriggerJQuery Element that trigged the menu.
- Source:
Returns:
- Type
- Object.<string, ContextMenuItem>
-
ContextMenuEvent
-
Type:
- jQuery.Event
- Source:
Properties:
Name Type Description dataContextMenuData -
ContextMenuIconCallback(e, $t, key, item, currentMenuData, rootMenuData)
-
Specifies the icon class to set for the item.
When using a string icons must be defined in CSS with selectors like
.context-menu-item.context-menu-icon-edit, where edit is the icon class specified.When using a callback you can return a class string to use that as the class on the item. You can also modify the element by using the $itemElement argument.
Parameters:
Name Type Description eContextMenuEvent | JQuery.Event $tJQuery keystring itemContextMenuItem currentMenuDataContextMenuData rootMenuDataContextMenuData - Source:
Example
var items = { firstCommand: { name: "Copy", icon: function(e, $itemElement, itemKey, item, currentMenuData, rootMenuData){ // Set the content to the menu trigger selector and add an bootstrap icon to the item. $itemElement.html('<span class="glyphicon glyphicon-star" aria-hidden="true"></span> ' + currentMenuData.selector); // Add the context-menu-icon-updated class to the item return 'context-menu-icon-updated'; } }, secondCommand: { name: "Paste", icon: "paste" // Class context-menu-icon-paste is used on the menu item. } } -
ContextMenuItemCallback(e, key, currentMenuData, rootMenuData)
-
The Callback is executed in the context of the triggering object.
Parameters:
Name Type Description eJQuery.Event Event that trigged the menu.
keystring Key of the menu item.
currentMenuDataContextMenuData Data of the (sub)menu in which the item resides.
rootMenuDataContextMenuData Data of the root menu in which the item resides. Might be the same as
currentMenuDataif triggered in the menu root.- Source:
Returns:
- Type
- boolean
-
ContextMenuItemTypeCallback(e, item, currentMenuData, rootMenuData)
-
Runs in the scope of the
<li>of the contextmenu.Parameters:
Name Type Description eJQuery.Event Event that trigged the menu.
itemContextMenuItem Menu item
currentMenuDataContextMenuData Data of the (sub)menu in which the item resides.
rootMenuDataContextMenuData Data of the root menu in which the item resides. Might be the same as
currentMenuDataif triggered in the menu root.- Source: