I’m doing a mercy dnd from a grid to a treegrid, where the grid rows change depending on the selected treegrid row. The dragged grid object can only be dropped on the selected treegrid row and it becomes a child of that selected row. When dropped, a data processor adds a row to the database.
When the object is dropped at level 3 in the tree, I still want the data processor to add the row to the database, but I also want to manually (via javascript code) add one or more additional rows to the tree and add rows to the database. I’m using the “onAfterUpdate” event of the data processor to determine when to manually add the rows. The first time, I drop a level 3 object, the associated level 4 object is object is correctly added and the database is updated accordingly. However, the next time I try to drop a level 3 object on the tree, it shows the object as being dropped but doesn’t add the associated child objects or update the database. On the drop, neither the “onBeforeUpdate” or “onAfterUpdate” events are triggered.
It appears from the data processor debug module that that the current update mode remains at “off” and doesn’t revert back “cell” as I have coded and expect it to. I am assuming that this is what is causing the problem but I’m not certain.
What might I be doing wrong?
Snippets of code:
...
d_Grid_DataProc = new dataProcessor("update.php");
d_Grid_DataProc.enableDataNames(true);
d_Grid_DataProc.init(d_Grid);
...
d_Grid_DataProc.attachEvent("onBeforeUpdate",function(id,type){
if (type == "inserted") {
d_Grid_DataProc.serverProcessor="update.php?...
}
...
return true;
});
d_Grid_DataProc.attachEvent("onAfterUpdate",function(id, type, new_id){
...
if (type=="insert"){
if (node_level == 3) {
manuallyAddChildRows(); // call function to add rows
}
}
d_Grid_DataProc.serverProcessor="opt_update.php";
return true;
});
function manuallyAddChildRows() {
...
d_Grid_DataProc.setUpdateMode("off");
d_Grid.addRow(z,....); // add associated child object
d_Grid_DataProc.setUpdated(z, false);
d_Grid_DataProc.setUpdateMode("cell", true);
}