Node and link menus

The Diagram widget provides an easy way to define menus you can associate with nodes and links.
To associate menus with nodes:
  • Use the following markup property:
    nodeMenu: a dijit.Menu associated with nodes.
    Note
    To access the node, the event handlers in the menu use the Diagram.lastMenuTarget property, which holds the entity associated with the event.
To associate menus with links:
  • Use the following markup property:
    linkMenu: a dijit.Menu associated with links.
    Note
    To access the link, the event handlers for the menu use the Diagram.lastMenuTarget property, which holds the entity associated with the event.
The following markup definitions associate a menu with diagram nodes:
<div dojoType="dijit.Menu" jsId="nodeMenu" style="display: none;"></div>
<div id="diagram"
     dojoType="ibm_ilog.diagram.widget.Diagram"
     nodeMenu="nodeMenu">
</div>
These menus work only for graphs created by the Diagram widget, either by a data store connection or by programmatic calls to createNode, or createLink and createSubgraph.