Total number of rows per group

I am using grouping in my grid
myGrid.groupBy(0, ["","","","#title","","#stat_total","","#stat_total"]);

myGrid.getRowsNum(); returns the total number of rows in the grid.
How to get the total number of rows per group?
I need this because I want to limit the number of rows per group.

There is no simple way , but you can use grid.forEachRowInGroup which iterate through all rows in the defined group.

forEachRowInGroup() doesn’t work.
Also i do not find it in the API. Any other solution?