Menu Items are the individual options for each menu choice. There are two important options that must be configured.
The onshow method is for when the menu item is about to be shown. This affords the opportunity to hide the menu or change its text.
Set's or gets whether this menu item is enabled or disabled to the user
Set's or gets the item (the text shown to the user when this menu item is shown)
This method is called when the entire menu is about to be shown. This method provides the opportunity for you to toggle the visibility of this menu item if it should not be shown or to change other HTML properties like the text of the item.
the function to be called when this menu item is about to be shown
Returns the element representation of this item. This creates a new Element but doesn't append it to anything. The ContextMenu itself calls this method and takes the Element returned and adds it to the ContextMenu's container.
Set's or gets whether this menu item is visible to the user when shown to the user;
Add a listener to this EventSource
the name of the event to listen for
the callback to add
this eventsource
Dispatch an event from this EventSource, supplying arguments to the listeners via an Array, rather than var-args.
the name of the event to dispatch
this EventSource
Dispatch an event from this EventSource
the name of the event to dispatch
optional arguments sent to the event listeners
this EventSource
Fire an event from this EventSource
the name of the event to dispatch
optional arguments sent to the event listeners
this EventSource
Remove a listener from this EventSource
the name of the event to remove the listener for
the callback to remove
this eventsource
Add a listener to this EventSource
the name of the event to listen for
the callback
this eventsource
Add a listener to this EventSource, which will be called at most once and will be removed the first time the given event fires.
the name of the event to listen for
the callback to add
this eventsource
Remove a listener from this EventSource
the name of the event to remove the listener for
the callback to remove
this eventsource
this event is fired from the item if the user selected this particular menu item. It is best to use the onaction method of MenuItem rather than adding an event listener directly.
this event is fired when the item is about to be shown and can be used to configure the appearance of the item. It is best to use the onshow method of MenuItem rather than adding an event listener directly.
The other method is onaction which is the function that handles the logic when the user selects that particular option.