DHTMLXTree ot of things to take care in drag n drop

there can be a possibility that a node can have more than one parent.



While performaing drag n drop i have to consider the following cases…



1. A node cannot be dropped into itself (since a node can have more than one parent this case is possible at different level of tree)

2. A node cannot be dropped into any of its child node ( this case occurs bcos a node can have more than one parent at diffrent levels),

3. When a node A is dropped on a node B, the childs of node A shud not be there at parent levels of node A



need help in handling these cases



thanks in advance


points 1 and 2 are correct and can not be changed. And parent is always dragged with its child.


If you want to change something in drag-n-drop logic, you can deny this operation using onDrag event and control tree nodes as you need (you can use insertNewItem and deleteItem methods):


tree.attachEvent(“onDrag”,function(sourceId,targetId){


/some other code here/


return false


})