Tree grid parent_id/dataprocessor

Add a top level(L1), – using agrid.addrow(�)

Add a child level(L2) , (using agrid.addrow(�, parent_id) parent_id is the timestamp of the top level derived from using agrid.getParentId(rId); (all good so far)

Save the tree grid structure.

We save the structure and the top level(L1) saves ok in the database however the child level(L2) fails to save(for some reason).

We use the to update the top(L1) level�s id on the grid but then inform the user that the child level (L2) failed to save and they need to update the child levels details. All ok so far.

However the user then changes the child level, correcting the error, and resaves the data. Only the child(L2) level details are passed down but as the parent id changed during the previous save we now have no way of referring to stored parent.

What is the best way to solve this?



If I understood your situation correctly - there is no built in solution for such case. DataProcessor sends actual parentId value to server, so it will be a new|updated ID.
If you need to preserve original ID you can store it as userdata inside element

Dataprocessor includes all userdata fields in requiest, so initial_parent parameter will be available with initial value of parentId

It seems that there is a list of parent_id’s in gr_pid

i used

pidStr = (String[]) request.getParameterValues(“gr_pid”);

which matches the id’s in :

dataStr = (String) params.get(“ids”);

Is this ok as a solution?

You can use such approach, but actually it is a bug in dataprocessor , in case of send-all-at-once, mode it must provide a separate gr_pid values for each updated row.
Please contact us directly at if you need updated js file of dhtmlxDataProcessor