ag-grid auto height for entire grid : <p>I can't find a good way to size the grid to fit all rows perfectly.</p>

<p><a href="https://www.ag-grid.com/javascript-grid-width-and-height/#gsc.tab=0" rel="noreferrer">documentation</a> only points to sizing by % or px. </p>

<p>Since I want it to size based on rows, I came up with the following function. Seem like im re-inventing the wheel, so maybe there is a better way? </p>

<pre><code>getHeight(type:EntityType) {
    var c = this.Apis[type] &amp;&amp; this.Apis[type].api &amp;&amp; this.Apis[type].api.rowModel // get api for current grid
        ? this.Apis[type].api.rowModel.rowsToDisplay.length
        : -1;
    return c &gt; 0
        ? (40+(c*21))+'px' // not perfect but close formula for grid height
        : '86%';
}
</code></pre>

<p>there has to be a less messy way..</p>
