MoveRowTo parent/child

When I use the moverowto functionality to copy a tree item to another tree it copies the parent item and ALL children. Is there a way for it to copy only the parent item?



In the end I am trying to copy maybe 1 or 2 of the child items from one grid to another



so:



Parent

–Child1

–Child2

–Child3

–Child4

–Child5



and I want to copy “–Child1” and “–Child3” to another grid along with “Parent”, but I do not want --Child2, --Child4, and --Child5 to copy.


As far as I understand, you use treegrid with mercy drag enabled.


There is no opportunity to copy only parent row.


But you can delete the unnecessary nodes after coping.


grid.moveRowTo(id,“row_sibling”,new_id,grid2);


grid2.deleteRow(grid2.getChildItemIdByIndex(id,1));


grid2.deleteRow(grid2.getChildItemIdByIndex(id,3));


grid2.deleteRow(grid2.getChildItemIdByIndex(id,4));


I am doing:



var child = mygrid.getChildItemIdByIndex(oldParentId,0);
while(child != null)
{
myDataProcessor.setUpdated(child,false);
mygrid.deleteRow(child);
child = mygrid.getChildItemIdByIndex(oldParentId,0);
}



grid2.moveRowTo(sId,parentId,‘copy’,‘child’,grid2,mygrid);



That all seems to work just fine, but when I am using dataprocessor and sending the data it appears to be doubling up the post. So retrieving column “RowId_c0” gives value of “title,title” instead of “title” this is for every field. So it seems like that row is getting added to the data proc then when I do row delete it isn’t removing from dataproc then when I do add again it adds it to the dataproc again, duplicating the data. So tried to throw in the setupdated but that didn’t work either.


Please, try to call setUpdated(child,false); after deleteRow(child);


mygrid.deleteRow(child);
myDataProcessor.setUpdated(child,false);