Simulate a dropped row without the DnD process

Hello everyone,

So in my grid, I have something like this :

ROW1
  Sub-Row11
  Sub-Row12
ROW2
  Sub-Row21

What I need to do is, whenever a user clicks on a menu item, I create a new Row (let’s call it ROW3) and attach “Sub-Row12” as a child (without changing its id). In other words, when I click a menu item, I want this :

ROW1
  Sub-Row11
ROW2
  Sub-Row21
ROW3
  Sub-Row12

I tried calling the onDrag (and even onDrop) event, without any results whatsoever. Here is the piece of my code :

myGrid.attachEvent("onDrag",
  function([params]){
    return true;
  }
);

myGrid.addRow("ROW3",[rowContent here]);
myGrid.callEvent("onDrag",["Sub-Row12","ROW3",myGrid,myGrid,0,0]);

Do I have to create again the said Sub-Row12 as a ROW3 child ?

Something like a moveItem for a tree, but in a treeGrid ?

You may use the moveRow(), moveRowTo() methods:
docs.dhtmlx.com/api__link__dhtml … verow.html
docs.dhtmlx.com/api__link__dhtml … rowto.html

Hi,

Yeah, the moveRowTo() does move the row to the good place, but my cells are quite mixed up : apparently, the moveRowTo doesn’t simply move the row in its current state, but rather create another one. This operation breaks the colspans and dynamic cell types I had set.

Your’re right.

Unfortunately the colspans and rowspans cannot stay after moving the row. and unfortunately that issue cannot be fixed.

Ok, thanks for the clarification.