I see this Note on ag-grid site:
Changing the row height is only supported in the in memory row model. You cannot use variable row height when using v
getRowHeight() is not supported in infinite row model. getRowHeight only works with the InMemoryRowModel
you can do the code below after getting the data:
setRowsHeight(){
    let gridHeight = 0;
    this.gridOptions.api.forEachNode(node => {
        let rowHeight = this.gridOptions.getRowHeight(node);
        node.setRowHeight(rowHeight);
        node.setRowTop(gridHeight);
        gridHeight += rowHeight;
    });
    if (!gridHeight) {
        return;
    }
    let elements = this.el.nativeElement.getElementsByClassName('ag-body-container');
    if (elements) {
        this.renderer.setElementStyle(elements[0], 'height', `${gridHeight}px`)
    }
}
I hope it will help you for me it resolved the issue