Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Letitia Stellern on Oct 27, 2009 14:34
open dhtmlx forum
Restricting Drag and Drop movement

I'm using DHTMLXtree, with drag and drop activated, using XML to populate the trees. I'm pretty new to this, so bear with me. :) (1) I am trying to only drag from my "components" tree to my "section" tree - not vice versa. (2) While dragging, I want to be able to restrict the movement of the nodes - eg. Dragging from the History "component" tree will only be able to go into the History "section" tree. Are these things possible?

Thanks.
Answer posted by Alex (support) on Oct 28, 2009 04:39

Hello, 

yes, it is possible. You can deny drag-n-drop for some nodes using onDragIn or onDrag event. For example: if ids of folders in component tree are the same as ones in section tree, the event handler can be following:

components_tree.attachEvent("onDrag",function(sourceId,targetId,beforeId,sourceTree,targetTree){

return (sourceTree.parentId(sourceId)==targetId);

})

Please, see details about events here http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxtree:event_ondrag ; http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxtree:event_ondragin