Behavior has changed from v2x treegrid. The documentation has always said that the automatic iterator was not entirely predictable, but it seemed to work reliably in v2x. In v3 forEachRow() only returns the top level rows. Following code snip returns all rows in the order defined in the XML.
for (i = 0; i < myGrid.getRowsNum(); i++) {
rid = myGrid.getRowId(i);
doForEachRow(rid); // user function
if (myGrid.hasChildren(rid) > 0) {
itemlist = myGrid.getAllSubItems(rid);
subItemIds = itemlist.split(",");
for (j = 0; j < subItemIds.length; j++) {
doForEachRow(subItemIds[j]); // user function
}
}
}