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?

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.


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:
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'?>
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'?>
Not a XML
server response received <?xml version="1.0" encoding='iso-8859-1'?>
Not a XML

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'?>
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 )


dhtmlxdataprocessor_debug2.zip (1.81 KB)

The new TID solved the problem.
Thanks very much for your help!

Cpacibo!