TreeGrid, change the parent id of a node

Hello,

I do have a question related to the drag and drop operations inside a TreeGrid:

If we use the DataProcessor, it’s clear the a d-n-d operation deletes the source row and creates a new one at the drag position. That’s a problem, if we do have other database records related to the id of the row, as this will be a new one.

I saw that a function exists to get the parent id of a row (getParentId(rowId) but I did not find a function to change the parent Id, i.ex setParentId(rowId,newParentId). Does it exists?

That would be usefull in many cases like:

  • moving rows and their kids to be child of other rows
  • deleting a row, attaching its kids to their “gran-parent”
  • bringing back a row to the root (parent id = 0)
  • and so on

It would also be fine to see the changes directly in the tree, even if they are applied through the buttons of a toolbar and not only in d-n-d.

Thanks in advance

You can change row id with changeRowId(oldRowId, newRowId) method

docs.dhtmlx.com/doku.php?id=dhtm … hangerowid

Also you can use Drag and Drop events or gridToGrid() method to control how rows will be dropped from one grid to another.
docs.dhtmlx.com/doku.php?id=dhtm … gridtogrid
docs.dhtmlx.com/doku.php?id=dhtm … and_drop&s[]=drag&s[]=and&s[]=drop