Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by kevin cook on Dec 18, 2008 20:16
open dhtmlx forum
drag and drop in treegrid

Good day,
I have a treegrid with d-n-d enabled and dataprocessor in debug mode. Mercy Drag and drop is disabled.
When I drag a branch to a new place in the tree, the dataprocessor properly and correctly inserts the branch and its children in the new position in the treegrid. Dataprocessor then deletes the branch and it's children from the old position.
But this is what is confusing me: It then re-sinserts the branch and its children back into the original position and then deletes it leaving the branch copied, in it's old position with a strikeout, and in the new position in the tree.

Can you tell me why this is happening?
Answer posted by Support on Dec 19, 2008 02:29
Are you using dataprocessor in auto-update or manual update initiation mode?
By default, when row deleted in grid with dataprocessor enabled, instead of immidiate deleting row just marked as deleted ( by striking it ) , real row deleting will occurs only when response from server will be received with confirmation of successful delete. 

If you have auot-update off - described behavior is correct one. 

DataProcessor has alternative mode, which change the way how d-n-d processed in grid, instead of insert and delete actions, it will generated update event for moved branch
mode can be enabled by 
     dp.setUpdateMode(mode,true);

>>and dataprocessor in debug mode.
Instead of using dp.enableDebug, you can add attached js file - it will add more useful debug output.


Answer posted by Kevin on Dec 19, 2008 05:59
I have myDataProcessor.setUpdateMode("cell",1); 
This behavior occurs not only when I drag and drop, but when I simply do a delete so perhaps the problem is in the XML I am sending back. 
Here is an example of the XML I am sending back: <data> <action type="delete" sid="Camera_Pack" tid="Camera_Pack" /> </data>
As an example, I am including the output from the enhanced dataproccessor debug script.  I am dragging a row with id "Camera_Pack"

  Current state
 ID:Camera_Pack1229694631755 Status: inserted
 ID:3061229694635353 Status: inserted
 ID:306 Status: deleted
 ID:Camera_Pack Status: deletedCurrent mode: cell
 
 row Camera_Pack1229694631755 marked as updated
 Initiating data sending for Camera_Pack1229694631755
 row 3061229694635353 marked as updated
 row 306 marked as updated
 Initiating data sending for 306
server response received <?xml version="1.0" encoding='iso-8859-1'?><data> <action type="insert" sid="Camera_Pack1229694631755" tid="Camera_Pack1229694631755" /></data>
Not a XML
 row Camera_Pack marked as updated
 Initiating data sending for Camera_Pack
server response received <?xml version="1.0" encoding='iso-8859-1'?><data> <action type="delete" sid="306" tid="306" /></data>
Not a XML
server response received <?xml version="1.0" encoding='iso-8859-1'?><data> <action type="delete" sid="Camera_Pack" tid="Camera_Pack" /></data>
Not a XML
Answer posted by Support on Dec 19, 2008 06:08
Please use attached js file instead of previously attached one, sorry for inconvenience.

The next snippet shows the code which outputed as result of insert operation
server response received <?xml version="1.0" encoding='iso-8859-1'?><data> <action type="insert" sid="Camera_Pack1229694631755" tid="Camera_Pack1229694631755" /></data>
It seems that you have not assigned new ID for newly created element? ( technically it not a problem, but if you have assigned some ID to new element , you need to return correct ID value , which will be used for all further operations, through "tid" attribute )

Attachments (1)
Answer posted by Kevin on Dec 19, 2008 07:14
The new TID solved the problem.
Thanks very much for your help!

Cpacibo!