getRowHeight() not working with rowModelType = 'infinite' with latest ag-grid version

前端 未结 2 667
我在风中等你
我在风中等你 2020-12-22 03:27

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

相关标签:
2条回答
  • 2020-12-22 03:49

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

    0 讨论(0)
  • 2020-12-22 03:59

    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

    0 讨论(0)
提交回复
热议问题