dhtmlxTree and dhtmlxDataprocessor

Hello,

How would one go with the autoupdating when we have two trees en nodes are dragged from one tree to another?

I tried with two different instances of dataprocessor, one for each tree. They work as long as you don’t drag out of the tree.

I don’t however see a way to keep things autosynced with the database when I drag something from one tree to the other.

Commands like deleteItem and insertNewChild don’t work using the onDrop event.
Deleteitem fails as the item is not in the original tree anymore
InsertNewChild inserts a child, but then we have the item twice in the destination tree

Anyone can help here?

Hello,

you may define onDrag event handler and deny the drag-n-drop from it. This handler can call deleteItem and insertNewChild instead:

tree1.attachEvent(“onDrag”,doOnDrag);
tree2.attachEvent(“onDrag”,doOnDrag);

function doOnDrag(sid,tid,bid,stree,ttree){
if(stree!=ttree){
stree.deleteItem(sid);
ttree.insertNewChild(tid,sid,stree.getItemText(sid));
return false;
}
return true
}