Number of rows in the grid

How to specify the exact number of rows that needs to be displayed in the grid. Currently i have used the syntax

grid.enableAutoHeight(true,400) //To display 20 rows

it is working for some grids but in some cases it is displaying more than 20 rows. Could you please suggest me on how to specify the number of rows instead of setting the height?

Are you using multiline mode? In such case height of grid’s row may be different for each row and there is no any stable way to detect which height need to be set for the grid.

In case of default mode the used approach must work.
Please beware that in case of xp,mt,gray skins the height of row is 22px