When dataProcessor fails on server-side

I have a tree that displays a hierarchy from a tree stored in a database. When a tree node is dragged within the tree, it fires a dataProcessor event that updates the db table on the server.

I can’t seem to figure out how to handle failures. When the server update fails, I’m returning this:

Where sid is the id of the node being moved, tid is the parent we’re trying to move it under, and old_parent is the original parent_id from the database BEFORE the update.

When the backend returns a failure, I want to move the node in the HTML tree back to its original position so that the client and server don’t get out of sync. My problem is that calling tree.moveItem (as shown below) causes the dataProcessor to fire again.

Is there a way to temporarily disable the dataProcessor object, move the node, then reenable the processor?



// my tree setup:

// use the dataProcessor to fire move_node when an item is dragged

myDataProcessor = new dataProcessor(“move_node.php”);


myDataProcessor.defineAction(“failure”, function(tag) {


return true;


function undoMove(btag)



var id_moved = btag.getAttribute(“sid”);

var new_parent = btag.getAttribute(“tid”);

var old_parent = btag.getAttribute(“old_parent”);

// we need to take the node of id ‘id_moved’ and move it BACK

// from ‘new_parent’ to ‘old_parent’

// THIS DOES NOT WORK!!! It causes some kind of client-side infinite loop that keeps calling back to the server.

tree.moveItem(id_moved, “item_child”, old_parent, null);


Is there a way to temporarily disable the dataProcessor object, move the node, then reenable the processor?

dataproc.autoUpdate=false;   //stop automatic updates
var temp=dataproc.updatedRows; // save existing state

    … any actions here …

dataproc.updatedRows=temp; // restore previous state
dataproc.autoUpdate=true;   //restore automatic updates

I am attempting to build the same function but am stuck at the part where the “tag” is passed to the custom handling function.
myDataProcessor.defineAction(“failure”, function(tag) { var id_moved = tag.getAttribute(“sid”); alert(“sid is:” & id_moved);
return true; });
This displays “sid is 0” no matter what I do.
Any suggestions?

Please check if “failure” action returns correct responce where sid was actually set:� �