Skip to content Skip to sidebar Skip to footer

Getrowheight() Not Working With Rowmodeltype = 'infinite' With Latest Ag-grid Version

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 virtual paging, viewport or en

Solution 1:

getRowHeight() is not supported in infinite row model. getRowHeight only works with the InMemoryRowModel

Solution 2:

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

Post a Comment for "Getrowheight() Not Working With Rowmodeltype = 'infinite' With Latest Ag-grid Version"