@@ -373,12 +373,80 @@ $("#container").bind("contextmenuselect", function(event, ui) {
373373<dt>select(event, ui)</dt>
374374<dd>
375375 Triggered when a menu item is selected.<br>
376- <code>ui.cmd</code> contains thecommand id.
376+ <code>ui.cmd</code> contains the command id.
377377 Return <code>false</code> to prevent closing the menu.
378378</dd>
379379</dl>
380380
381381
382+ ### Menu Entry Definition
383+
384+ The menu structure is defined as (nested) list of plain objects:
385+ ` ` ` js
386+ $ (... ).contextmenu ({
387+ ...
388+ menu: [
389+ {title: " Copy" , cmd: " copy" , uiIcon: " ui-icon-copy" },
390+ {title: " ----" },
391+ {title: " More" , children: [
392+ {title: " Sub 1" , cmd: " sub1" },
393+ {title: " Sub 2" , cmd: " sub1" }
394+ ]}
395+ ],
396+ ...
397+ });
398+ ` ` `
399+
400+ Follwing a list of available menu definition properties:
401+ <dl>
402+ <dt>action</dt>
403+ <dd>
404+ Type: <code>Function</code>, default: n.a.<br>
405+ Optional callback that will be executed when the entry is selected.
406+ </dd>
407+ <dt>addClass</dt>
408+ <dd>
409+ Type: <code>String</code>, default: ""<br>
410+ Additional class to be added to the entries html element. Separate multiple
411+ classes with space.<br>
412+ Custom CSS may be applied like <code>.ui-menu .my-class { color: red; }</code>.
413+ </dd>
414+ <dt>cmd</dt>
415+ <dd>
416+ Type: <code>String</code>, default: ""<br>
417+ Optional identifier associated with the menu entry.
418+ It can later be accessed in the *select* event by <code>ui.cmd</code>.
419+ </dd>
420+ <dt>data</dt>
421+ <dd>
422+ Type: <code>Object</code>, default: {}<br>
423+ Optional hash of additional properties that will be added to the entries *data*
424+ attribute.<br>
425+ It can later be accessed in the *select* event by <code>ui.item.data()</code>.
426+ </dd>
427+ <dt>disabled</dt>
428+ <dd>
429+ Type: <code>Boolean</code>, default: false<br>
430+ Pass <i>true</i> to disable the entry.
431+ </dd>
432+ <dt>title</dt>
433+ <dd>
434+ Type: <code>String</code>, default: <code>""</code><br>
435+ The displayed name of the menu entry. Use <code>"---"</code> to define a
436+ separator.
437+ </dd>
438+ <dt>uiIcon</dt>
439+ <dd>
440+ Type: <code>String</code>, default: ""<br>
441+ If defined, an icon is added to the menu entry. For example passing
442+ <code>"ui-icon-copy"</code> will generate this element:
443+ <code><span class='ui-icon ui-icon-copy' /></code>.<br>
444+ See also [Icon Overview](http://api.jqueryui.com/theming/icons/).
445+ </dd>
446+
447+ </dl>
448+
449+
382450# Tips and Tricks
383451### [Howto] Add right-aligned shortcut hints
384452
@@ -401,7 +469,6 @@ and make it right aligned via CSS:
401469
402470### [Howto] Modify the menu using an asynchronous request
403471
404-
405472` ` ` js
406473$ (document ).contextmenu ({
407474 ...
0 commit comments