Login Register

How to disable drag and drop (dnd) function on Dijit Tree?

Hi I have used dijit Tree to display a company hierarchy. It works fine except the "annoying" drag-and-drop function. DnD does not required in this context, but I can't get ride of it. If I commented out the following line, the selected node will not get hightlighted, so users do not know which node is selected.

// dndController: dijit._tree.dndSource,

My question is: is there any way to disable DnD feature, but still have the selected node highligted?

Part of the code is shown below:

		

dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dijit.Tree");
dojo.require("dijit.form.Button");
dojo.require("dijit._tree.dndSource");
dojo.require("dojo.parser");	

var selected=[];
var globalId=1000;
var lastSelected=null;

var stores = new dojo.data.ItemFileWriteStore({url:"hierarchyTree.jsp?cmd=json"});
		
var init = function(){
var tree=new dijit.Tree({
	store: stores,
	query: "{top: true}",
	id: 'myTree', 
	childrenAttr: ['items'],
	dndController: dijit._tree.dndSource,
	getIconClass: function(item){
		return "cssClass";
	},

	getLabel: function(item){
		var label = stores.getLabel(item); 
		return label;
	},
	
	onClick: function(item,node){
		lastSelected = item;
	}
  }, dojo.byId("Groups")); 
  
  ...
  

Thanks!