Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stefan Riedel-Seifert on Jan 26, 2009 02:12
open dhtmlx forum
Tree: DataProcessor - supplied data not enough

Hello,

i am using tree with data processor. Up to this all works fine.

in the update routine i will get information about :

tr_id = request->get_form_field( 'tr_id' ). "node ID
status = request->get_form_field( '!nativeeditor_status' ).

tr_order = request->get_form_field( 'tr_order' ). " node sequence on the level
tr_pid = request->get_form_field( 'tr_pid' ). " parent ID
tr_text = request->get_form_field( 'tr_text' ). " node text(label)

This is not quite comfortable. I need also the old parent id of the moved node, because the node can have more than one parents
from the logically point of view.

(Think for example of an UNIX-filesystem, there a folder can have symbolic links).

The only solution seems so far, that I on the drag&drop event handler trying to get the actual parent and appending it on the
dataprocessor url like:

tr_oid = tree.getParentId(id);
dataProcessor.serverProcessor = 'update.do?mode=copy&tr_oid=' + tr_oid;

Is there any other solution available?

Best regards,
Stefan

Answer posted by Support on Jan 26, 2009 02:50
You can store any additional info in userdata, all userdata records sent to server side

tree.attachEvent("onDrag",function(id,...){
  ...
  tree.setUserData(id,"tr_oid",some);
  ...
});


Answer posted on Jan 26, 2009 02:56

Hello,

ok. This is a liitle bit more elegant than my solution :-), but does it not makes sense to deliver this information as standard?

Best regards,

Stefan

Answer posted by Support on Jan 26, 2009 05:45
Technically this info can be obtained on server side, in most cases we can get current parentID value of item in DB ( or in any other storage ) and made all necessary procession before setting parentID to new value. 
While the parameter can be useful it not really necessary for update operations. 
More than that, dataprocessor with auto-update mode as "off", allows to drag the same row multiple times - as result the "old parent ID" become not so useful
Answer posted by Stefan Riedel-Seifert on Jan 26, 2009 06:11

OK, the last sentence is quite correct and makes no sense, when autoupdate is off. So we can close this thread. Solution was provided.

Thank you very much one time more :-),

Stefan