Sample: dhtmlxGrid Auto height dhtmlxGrid main page
X

In auto height mode grid expand if necessary to prevent vertical scrolls, and shrinks not to occupy external place

Add row
Remove Selected Row
Turn AutoHeight On/Off
 
<div id="gridbox" width="100%" height="250px" style="background-color:white;overflow:hidden"></div>
<script>
 
        mygrid = new dhtmlXGridObject('gridbox');
        ...
        mygrid.enableAutoHeigth(true,"400");
        mygrid.init();
        mygrid.loadXML("../grid.XMl");
</script>