How to look over all rows in the grid view?

I need look over all rows and make hidden all rows instead one,

then (aftrer click some button) I need make visible all rows.

How to do it?

Direct solution is

grid.forEachRow(function(id){   // for all rows
    grid.setRowHidden(id,true); //hide row
});


P.S. If you need such functionality for some kind of filtering - please check built in filters and grid.filterBy functionality - it will work much faster