Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Cliff on Mar 04, 2008 17:07
open dhtmlx forum
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 <action type=”insert” sid=”oldtimestamp” tid=”databaseid” > 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?
ta
Cliff
Answer posted by Support on Mar 05, 2008 08:36
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
    grid.addRow(new_id,...
    grid.setUserData(new_id,"initial_parent",grid.getParentId(new_id));

Dataprocessor includes all userdata fields in requiest, so initial_parent parameter will be available with initial value of parentId
Answer posted by Cliff on Mar 05, 2008 14:14

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?
Answer posted by Support on Mar 06, 2008 06:34
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 support@dhtmlx.com if you need updated js file of dhtmlxDataProcessor