我已经能够将一个带有两个MenuItem的简单dijit.Menu绑定到一个dijit.Tree与Menu.bindDomNode(Tree.domNode)的节点,但我想改进哪些节点获取上下文菜单并且无法获取domNodes从Tree项目绑定菜单.我希望有一个更简单的方法来做到这一点?
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);
} …Run Code Online (Sandbox Code Playgroud) dojo ×1