There is no out of the box way to do this, but you can achieve this by adding an event handler for mouse down
dojo.connect(this.tree, 'onMouseDown', lang.hitch(this,this.onTreeRightClick));
onTreeRightClick : function(event)
{
if(event.button=="2"){
var node = dijit.getEnclosingWidget(event.target);
var nodes=this.tree.selectedNodes;
if(nodes.indexOf(node)>-1)
return;//if the node is already selected do not alter selected nodes.
this.tree._setSelectedNodeAttr(node);
}
}
精彩评论