Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by John on Oct 07, 2008 07:33
open dhtmlx forum
DHTMLX tree


Is there a way to limit how many levels of items can be in the tree? I only want two levels of items in the tree where I don't want the user to be able to enter more than two levels.

How can I do this?

I.e.

- Software (first level item)
- Windows Software (second level item)
- Hardware (first level item)
- Video cards (second level item)

Thanks,

John
Answer posted by Support on Oct 07, 2008 08:20
If you want to block such operation during d-n-d , it can be done as 

tree.attachEvent("onDrag",function(sid,tid){
   if (tree.getLevel(tid)>1) return false; //block drop on second level items
   return true;
});