GridOptions 接口 ag-Grid

GridOptions interface ag-Grid

在 ag-Grid documentation 上,关于这个 GridOptions 接口.

提到了很多

Grid Properties, Grid Events, Grid Callbacks,所有 'claim'

this options are available through the GridOptions interface

例如,我设法访问了 columnDefs 属性 而没有此 gridOptions 的任何 'usage' , 通过以下方式:

.html

<ag-grid-angular 
            style="margin: auto;
            width: 80%; height: 70%;
            #agGrid
            class="ag-theme-material"
            [rowData]="rowData" 
            [columnDefs]="columnDefs"
            >
</ag-grid-angular>

.ts

private columnDefs;

constructor() {
    this.columnDefs = ...; // columns array
   }

但是,我不知道如何在不调用此 gridOptions 的情况下集成某些功能,例如 api 提供的 accessing row nodes

我如何提及/到达此网格选项?

在您的 HTML 中提及 gridOptions 并输入以下代码

 [gridOptions]="gridOptions"

在你的 Component.ts

public gridOptions: GridOptions;

在 ngonINIT 上

this.gridOptions.columnDefs=this.columnDefs;

然后你可以在代码的任何地方访问这个gridoptions。