ag-grid高度= 100%崩溃

时间:2017-02-22 19:52:41

标签: ag-grid

本地运行Basic AngularJS 1.x Example,发现style="height: 100%;"网格是否折叠为水平线。将其设置为100px之类的其他工作。 除了我的Angular之外,其他一切都是1.5.0,而ag-grid是v8.1.0。

HTML

<br />ag-Grid using AngularJS
    <div ng-controller="exampleCtrl">
            <div ag-grid="gridOptions" class="ag-fresh" style="height: 100%;">
            </div>
        </div>

JS与教程相同。看起来像个bug。

3 个答案:

答案 0 :(得分:7)

这几乎可以肯定是因为你的html文件中有DOCTYPE html。

如果这样做,那么您需要确保网格容器的填充高度为非0,否则它将显示为您找到的平面线。

这不是特定于ag-Grid的问题 - 它的副作用是没有使用怪癖模式。

最简单的事情是:

<style>
    html, body {
      width: 100%;
      height: 100%;
    } 

This StackOverflow Question/Answer很好地解释了潜在的问题

答案 1 :(得分:6)

您应尝试通过设置DomLayout 来设置ag-grid的autoHeight。

有关角度,请参见下面的示例代码。

onGridReady(params) {
    this.gridApi = params.api;
    this.gridColumnApi = params.columnApi;

    //The ag-grid is not enlarging based on the page height, 
    //so dynamically adjusting the height of the grid
    this.gridApi.setDomLayout("autoHeight");
}

作为参考,请参见此https://plnkr.co/edit/Jb1TD7gbA4w7yclU?preview

答案 2 :(得分:0)

.ag-root-wrapper-body.ag-layout-normal.ag-focus-managed {
    height: 100%;
}

相关问题