count and totals in footer for filtered tree

We need to provide totals for count and certain other matrices in footer of tree grid. For unfiltered tree grid it works fine but when we filter the grid we do not know which child rows are in filtered data. Any way or api?

For ex:

suppose we have:

-Football (22)
----FootCricket (100)
----Handball (50)

When we filter by ‘Foot’, the tree will show the parent and the first child only.

But when we try to enumerate the tree, i.e when we call getSubItems of the parent node (Football), we get both children and not just ‘FootCricket’ !!!

here is current code,

function sumColumn(ind) {
var out = 0;

for (var i = 0; i < treegrid.getRowsNum(); i++) {
    v = treegrid.cells2(i, ind).getValue();
    rowId = treegrid.getRowId(i);
   if (treegrid.hasChildren(rowId)>0){
       if (!treegrid.getOpenState(rowId)){
            subitems = treegrid.getSubItems(rowId);
            var arry = subitems.split(',');
            for (var j=0; j<arry.length; j++) {
                v = treegrid.cellById(arry[j], ind).getValue();
                if(v=='' || v==' ') v=0;
                out += parseFloat(v);
            }
        }
    }
    else{  
        if(v=='' || v==' ') v=0;
        out += parseFloat(v);
    }
}
return out;

}

function getRowCount(){
var out = 0;

for (var i = 0; i < treegrid.getRowsNum(); i++) {
    out += 1
    if (!treegrid.getOpenState(treegrid.getRowId(i))){
        v = treegrid.hasChildren(treegrid.getRowId(i));
        out += v
    }
}
return out;

}

some suggestions from our devs.
a) They already have a method called forEachRow(), which we can use to traverse all rows in the tree. But this includes filtered rows as well. If we can have a method like forEachFilteredRow() or forEachVisibleRow(), that traverses through only the visible rows in the tree, that will solve all our problems…

b) If they can provide a method like isRowVisible(rowid), that returns true/false depending on whether a row is filtered out or not… Such a method will also solve our issues.

following up to see if any answers or do you need more information.

forEachRow iterator will return ids of all known rows, it is not affected by filtering

In case of grid 2.6 you can use

grid._h2.forEachChild(0, function(el){ alert(el.id); });

It will iterate through treegrid hierarchy, including only filtered rows.
( Be sure that dhtmlxtreegrid_filter.js was included on the page )

Also, if you are interested only in visible rows (not including rows in closed branches ) you can iterate by row indexes

for(var i=0; i<grid.getRowsNum(); i++) alert(grid.getRowId(i));