Grid - sizing height to match rows

I have a grid in a layout cell where the number of rows is data driven but is fixed once the rows have been added. I would like to be able to add the rows (using addRow) then determine the correct height to make the grid and its layout cell so that all the rows show but no more. I can’t see a method to get the height of either the column header row or the rows themselves.

There is no API to get such details about grid
You can get the height directly from DOM objects as

var h_height = grid.hdr.offsetHeight;
var r_height = grid.obj.offsetHeight;

I was with the same problem, so I resolved this way:

function stopLoadingGridbox(){
    …
    gridbox.adjustHeight();
}
       
function adjustHeight( gridboxObj ){

    var newHeight = gridboxObj .getRowsNum()*20+48;

    gridboxObj .entBox.style.height = newHeight;
    gridboxObj .gridHeight = newHeight;
    gridboxObj .setSizes();
}

gridbox.adjustHeight = function(){

    adjustHeight(this);
};

gridbox.getOnLoadDetails = function(){

    stopLoadingGridbox();
}

When load is complete, the stopLoadingGridbox function is called, and it calls the adjustHeight function that adjusts the grid height.
I use the version 2.0 professional and this code has been used in my pages using the “modern” skin.

hope could it helped