typescript - GridOptions 接口 ag-Grid
问题描述
在 ag-Grid文档中,提到了很多关于这个GridOptions 接口的内容。
this options are available through the GridOptions interface
例如,我设法通过以下方式访问了没有任何“使用”此gridOptions的columnDefs属性:
.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 提供的行节点。
我怎样才能提到/到达这个 gridOptions?
解决方案
在你的 HTML 中提到 gridOptions 把下面的代码
[gridOptions]="gridOptions"
并在您的 Component.ts
public gridOptions: GridOptions;
在 ngonINIT 上
this.gridOptions.columnDefs=this.columnDefs;
然后您可以在代码中的任何位置访问此网格选项。
推荐阅读
- python - 在 spyder 中导入第二个库时出现 KeyError / freeze importlib._bootstrap 错误
- vue.js - vue-router:如何在多个元素中使用视图路由器?
- javascript - 在作者演示没有问题的情况下无法加载 js 框架
- python - 创建多个会话时发出“远程结束关闭连接而无响应”
- python - 如何在 Mac 上的 Sublime Text 上安装 Pygame
- ios - WKWebView 内的 iframe 问题
- r - 创建具有不同 sd 和 mu 的行或列的矩阵
- networking - 接收方是否会丢弃具有无效 ACK 号的数据包?
- sql - 输出总是 1
- c# - 如何为存储为数组 [ticks,offset] 的 DatetimeOffset 创建 MongoDB TTL 索引?