Categories | Question details Back To List | ||
change position of child row in a treegrid Hi, How we can change the row position of child row in a treegrid. I have written two function at dhtmlxgrid.js that takes the child row to the top and bottom of his relevant parent this.moveRowTop=function(row_id){ var r = this.getRowById(row_id); var childpos = this.rowsCol._dhx_find(r); var childparentid=this.getParentId(r.idd); var pr = this.getRowById(childparentid); var parentpos = this.rowsCol._dhx_find(pr); var no=parentpos+1-childpos ; return this.moveRowUDTG(row_id, no); } this.moveRowBottom=function(row_id){ var r = this.getRowById(row_id); var childpos = this.rowsCol._dhx_find(r); var childparentid=this.getParentId(r.idd); var pr = this.getRowById(childparentid); var parentpos = this.rowsCol._dhx_find(pr); var noofchild=this.hasChildren(childparentid); var no=parentpos+noofchild-childpos ; this.moveRowUDTG(row_id, no); } But it is not working. please provide me some sample code for this. I have to do a child fc on the top or bottom of its relevant parent depending on situation. Its very urgent for our product. Answer posted by Support on Dec 01, 2008 01:51 You can use as last child grid.moveRowTo(rowId, targetId, "move", "child"); as first child grid.setDragBehavior("sibling-next"); grid.moveRowTo(rowId, targetId, "move", "sibling"); Answer posted by Vikrant on Dec 01, 2008 02:58 Hi, I have written the code below but it doesnot work in case of move up. In that case we need to change the order of a row so the rowis and target id is same. Please help me. mygrid.moveRowTo(rowid, rowid, "move", "sibling");
Answer posted by Vikrant on Dec 01, 2008 03:10 Hi, I am also facing the same problem. The simple form of my situation: PARENT ROW If I select row "CHILD #3" and then click the button, the grid should change to: In the above similar fashion, I'm creating button to move selected row to the bottom i.e the result would become: Note: my grid implementation is WITHOUT dragndrop support. (with my implementation, user should not be allowed to do dragndrop of rows) Thanks.
Answer posted by Support on Dec 01, 2008 03:15 Working sample sent by email. |