Unable to drag-and-drop row after changing it's ID?

When you drag-and-drop a row in DHTMLX Grid, it gives the row a randomly generated ID (as I understand, it’s to prevent the same ID from existing after a drop).

I needed to work around this, because I could not have my rows ID being changed since the entire app depends on the correct row ID. So as a work around, I store the ID prior to moving, and then I change the row ID BACK to what it was, after moving. I do this with the grid.changeRowId(old,new) function.


After I change the rows ID (after its drag-and-dropped), I can no longer drag-and-drop that row. If I try dragging-and-dropping that row, the “insert” part of the sequence fires, but the “delete” part does not.

Can anyone here please help me figure out why the entire drag-and-drop sequence will not complete after I have already dragged an item once?

update - still haven’t solved this, but it appears to be an issue with the rowId actually being completely lost after a drag-and-drop…

You may not use changeRowId() method. After you drop row to target grid, “insert” operation is fired. Your server side should return response in following format:

<data> <action type="some" sid="some" tid="some" /> </data>

where sid - the original id of the row (the same as gr_id);
tid - the id of the row after the operation

if sid is different than tid, row id will be changed automatically.

So what do I do if I want to drag-and-drop a row, but do not want the ID of the row to be different after the drop?

You should return responce where “tid” attribute will have necessary row id