I have been able to bind a simple dijit.Menu with two MenuItems to the nodes of a dijit.Tree wtih Menu.bindDomNode(Tree.domNode), but I would like to refine what nodes get the context menu and am having trouble getting domNodes from Tree items to bind the menu to. I am hoping there is a much easier way of doing this?
datStore = this.DataStore;
mdl = this.Model;
tree = this.Tree;
datStore.fetch({
query: { nodeType: "ROOT" },
onItem: function(item, request) {
dojo.forEach(datStore.getValues(item, "children"), function(childItem) {
var itemNode = tree.getNodesByItem(mdl.getIdentity(childItem));
console.log(itemNode): //returns the widget, and the widget has a domNode property that seems ok with firebug traversing of the itemNode object, though the div value is 'dimmed' in firebug (not valid node yet in the DOM?)
console.log(itemNode.domNode);//returns 'undefined', so the binding below does not work
if (childItem.nodeType == "MATCHED_VALUE") {
Menu.bindDomNode(itemNode.domNode);
}
});
}
});