How to iterate over selected and filtered rows?

Hi!



My function:



for(var i = 0; i<sel_ar.length;i++) {

                    s1+=parseFloat(this.cells(sel_ar[i],3).getValue());    

                    $("#s1").html(s1);    

                }    



set sum of selected rows inside s1 element, but this sum includes all selected rows - also those one not included in current filter.



How can I check if some cell is visible in current filter?


To iterate over all filtered rows you can use row’s indexes:


for (var i=0; i<mygrid.getRowsNum()-1; i++){
        s1+=parseFloat(mygrid.cellByIndex(i,3).getValue());
        $("#s1").html(s1);
}

but it become quite complicated if you need to take in account both selected and filtered rows in the same time.

>>How can I check if some cell is visible in current filter?
You can try to use next check

if (this.getRowIndex(id)==-1) continue; //if row index can’t be located - row not not included in current filter