title: How to add Dojo tree right click context menu only for the root? not for remaining children
body: <p>I have created a tree using dojo.
  I want to add right click context menu on the root of the tree.
  Following is the code</p>
  
  <p>
  </p>
  
  <pre><code>&lt;head&gt;
      &lt;link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.3/dijit/themes/tundra/tundra.css"&gt;
      &lt;style type="text/css"&gt;
          body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
      &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body class="tundra "&gt;
      &lt;ul dojoType="dijit.Menu" id="tree_menu" style="display: none;"&gt;
          &lt;li dojoType="dijit.MenuItem" onClick="alert('Hello world');"&gt;
              Item #1
          &lt;/li&gt;
          &lt;li dojoType="dijit.MenuItem"&gt;
              Item #2
          &lt;/li&gt;
      &lt;/ul&gt;
      &lt;div dojoType="dojo.data.ItemFileReadStore" jsId="menuContinentStore"
      url="http://docs.dojocampus.org/moin_static163/js/dojo/trunk/dijit/tests/_data/countries.json"&gt;
      &lt;/div&gt;
      &lt;div dojoType="dijit.tree.ForestStoreModel" jsId="menuContinentModel"
      store="menuContinentStore" query="{type:'continent'}" rootId="continentRoot"
      rootLabel="Continents" childrenAttrs="children"&gt;
      &lt;/div&gt;
      &lt;div dojoType="dijit.Tree" id="menuTree" model="menuContinentModel" showRoot="false"
      openOnClick="true"&gt;
          &lt;script type="dojo/connect"&gt;
              var menu = dijit.byId("tree_menu");
              // when we right-click anywhere on the tree, make sure we open the menu
              menu.bindDomNode(this.domNode);
  
              dojo.connect(menu, "_openMyself", this, function(e) {
                  // get a hold of, and log out, the tree node that was the source of this open event
                  var tn = dijit.getEnclosingWidget(e.target);
                  console.debug(tn);
  
                  // now inspect the data store item that backs the tree node:
                  console.debug(tn.item);
  
                  // contrived condition: if this tree node doesn't have any children, disable all of the menu items
                  menu.getChildren().forEach(function(i) {
                      i.attr('disabled', !tn.item.children);
                  });
  
                  // IMPLEMENT CUSTOM MENU BEHAVIOR HERE
              });
          &lt;/script&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojo/dojo.xd.js"
  djConfig="parseOnLoad: true"&gt;
  &lt;/script&gt;
  &lt;script&gt;
      dojo.require("dijit.Menu");
      dojo.require("dijit.MenuItem");
      dojo.require("dijit.tree.ForestStoreModel");
      dojo.require("dojo.data.ItemFileReadStore");
      dojo.require("dijit.Tree");
  &lt;/script&gt;
  &lt;!-- NOTE: the following script tag is not intended for usage in real
  world!! it is part of the CodeGlass and you should just remove it when
  you use the code --&gt;
  &lt;script type="text/javascript"&gt;
      dojo.addOnLoad(function() {
          if (window.pub) {
              window.pub();
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p></p>
  
  <p>But the problem is this code creats right click context menu for all non leaf children.
  I want right click context menu only for root.
  How to achieve this?</p>