The Menu widget models a context menu, otherwise known as a right-click or popup menu, and they also appear in ComboButton and DropDownButton widgets.
MenuItem widgets are the actual items in the menu. The PopupMenuItem is like a MenuItem, but displays a submenu or other widget to the right . A PopupMenuItem always has two child nodes: a tag with the displayed label (usually in a SPAN tag), and a widget to be popped up, typically a dijit.Menu widget.
Right click anywhere in Grey Area
|
dijit.Menu
Define a drop down or context (right-click) menu.
|
||
|
Attributes
|
||
| contextMenuForWindow | Boolean false |
if true, right clicking anywhere on the window will cause this context menu to open; if false, must specify targetNodeIds |
| popupDelay | Integer 500 |
number of milliseconds before hovering (without clicking) causes the popup to automatically open |
| targetNodeIds | String[] | Array of dom node ids of nodes to attach to. Fill this with nodeIds upon widget creation and it becomes context menu for those nodes. |
|
Methods
|
||
|
Methods
|
||
| addChild(/*Widget*/ child, /*Integer?*/ insertIndex) | Process the given child widget, inserting its dom node as a child of our dom node | |
| bindDomNode(/*String|DomNode*/ node) | attach menu to given node | |
| Widget[] getChildren() | returns array of children widgets | |
| removeChild(/*Widget*/ page) | removes the passed widget instance from this widget but does not destroy it | |
| unBindDomNode(/*String|DomNode*/ nodeName) | detach menu from given node | |
|
Extension Points
|
||
| onClose() | callback when this menu is closed | |
| onOpen(/*Event*/ e) | Open menu relative to the mouse | |
|
dijit.MenuItem
One menu item, usable in a Menu
|
||
|
Attributes
|
||
| disabled | Boolean false |
if true, the menu item is disabled if false, the menu item is enabled. Use setDisabled() to change after creation time. |
| iconClass | String | class to apply to div in button to make it display an icon |
| label | String | Menu text. Typically specified as innerHTML when declaring a Menu programmatically. |
|
Methods
|
||
| setDisabled(/*Boolean*/ value) | enable or disable this menu item | |
|
Extension Points
|
||
| getParent() | returns the parent widget of this widget, assuming the parent implements dijit._Container | |
| onClick() | User defined function to handle clicks | |
|
dijit.MenuSeparator
A line between two menu items
|
| Action | Key |
|---|---|
| Open a context menu | On Windows: shift-f10 or the Windows context menu key On Firefox on the Macintosh: ctrl-space |
| Navigate menu items | Up and down arrow keys |
| Activate a menu item | Spacebar or enter |
| Open a submenu | Spacebar, enter, or right arrow |
| Close a context menu or submenu | Esc or left arrow |
| Close a context menu and all open submenus | Tab |
When reading a menu item on Firefox 2, JAWS 8 may say "submenu" for an item that does not have a submenu. This will be fixed in Firefox 3.