Open All SubGrids by one click

I have a grid with a subGrid in the first column of the every row. I can open the subGrids one by one. How can I open all the subGrids from a click?

Here is one way:

function toggleAllSubgrids( open ) { mygrid.forEachRow(function(id) { var cell = mygrid.cells(id,0); //INDEX - index of columns with subgrids if ( open ) cell.open(); else if ( !open ) cell.close(); }); }