Iterating paged grid items

I have a grid with paging enabled

gridDetails.enablePaging(true, 10, 10, 'DetailsGridPager', true);

The documentation, says getRowsNum() should be used to iterate rows on the current page only.

BUT this iterates all rows (7201, in my case)

for (var idx = 0; idx < gridDetails.getRowsNum(); idx++) { var rowId = gridDetails.getRowId(idx); gridDetails.cells(rowId, 0).setValue(checkedflag); }

The other method mentioned using forEachRow. This method says it iterates ‘parsed’ rows, i guess that means cached rows because the following code will check all rows that i’ve viewed.
ie: click page 1, 2, 3, 4, 5, then back to page 3. Click my select all button (that fires this code) and it checks all rows on pages 1 through 5.

gridDetails.forEachRow(function(rowId) { gridDetails.cells(rowId, 0).setValue(checkedflag); });

So, how do I just iterate all rows being displayed on the current page in order to check their checkboxes?

Please, try to use the getStateOfView() method: … tateofview

this worked but I ended up using the onPageChanged event which also has the starting and ending indexes.