Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mingang Hsu on Nov 06, 2008 12:57
open dhtmlx forum
Drag drop from grid to tree

To drag item from grid and drop to tree, tree control always creates a child node with text as return value of "DragAndDropFromGridToTree". Does anyone know drag and drop does not create a child node at tree control? Since I try to simulate WIndow Explore. While you drag and drop a file from right panel (grid) to left panel (tree), left panel tree never shows the file node.

Other issure is if drag and drop failed, and want to return dragged data back to grid. Set return value to false at DragAndDropFromGridToTree does not do this. It only creates a child node at tree with text "false".

Thanks
Answer posted by Support on Nov 10, 2008 01:34
You can try to use onDrag event handler of the tree. If it returns true the node from grid will be moved to the tree. But if it returns false, the row will remain in the grid:

tree.attachEvent("onDrag",function(sid,tid,sobj,tobj){
if(...) return false
return true
})
 
Using onDrop event handler you can delete new node after it is moved from the grid:
tree.attachEvent("onDrop",function(sid,tid,sobj,tobj){
tree.deleteItem(sid);
})