treegrid loop through all rows error add row

Hi,



the problem we have is follows:



we have a treegrid with a few items: we use the grid.forEachRow function to loop through all items which loops through them correctly in the order they are displayed in the grid



however, we then add a row and use the moveRowTo function to move it to a different position in the treegrid. then when we run the grid.forEachRow function again it doesnt loop through the grid in the order displayed, it loops through it assuming that the row we just added is at the end.



how can we ensure that looping through the treegrid will always be in the order that is displayed



thanks

This is expected behaviour of forEachCell method. You can iterate in the treeGrid with indexes. Please see more infomation here dhtmlx.com/docs/products/dhtmlxG … ingthrough

you specify for each cell method and but i didnt mention that, i mentioned for each row mthd. you also misunderstood. i have a treegrid and the iteration you pointed me to only iterats through visible rows.

we want to iterate through all rows in a treegrid even if they are not open, visible, or yet loaded from xml, and need it to give iterate through in the order they are displayed

thanks

Sorry, in the previous answere should be “forEachCell”. forEachRow method just iterate through all rows, order of iteration not equal to current order of grid ( actually it is always use order which was in original XML file )

If you need to iterate through all rows in current order, you can use next code

mygrid._h2.forEachChild(0,function(row){
    var id=row.id;
    //any code here
});

It will iterate through treegrid in actual order of rows

thanks