dhtmlxTree; dhtmlxDataProcessor - cannot cancek node inserti

Hi,



I use drag’n’drop on a tree to copy a node from one folder to another (mercy drag).

On the server side I detect that the operation violates some business rules and cannot be completed.

I return an error XML, like this:



    Cannot copy node



On the client side I want to show the message and get rid of the node in the target folder:

dp.defineAction(“error”, myErrorHandler);

function myErrorHandler(tag) {

    alert(tag.firstChild.data);

    var sid = tag.getAttribute(“sid”);//sid - temp id assigned by dhmlx

    dp.stopOnError = true;

    myTree.deleteItem(sid, false);

    return false;

}



The problem is that though the node (which failed to get inserted on the server side) gets stroked out it still remains in the target folder.

How can I get rid of the node (effectively cancel insertion on the client because it failed on the server)?



Thanks a lot,

Victor

Update your code as

function myErrorHandler(tag) {
var sid = tag.getAttribute(“sid”);//sid - temp id assigned by dhmlx
// dp.stopOnError = true;
myTree.deleteItem(sid, false);
myTree.deleteItem(sid, false); //dupplicate call to fully remove row
dp.setUpdated(sid,false); //remove updated flag from the item
return false;
}

Thanks a lot, it works fine now