【发布时间】:2020-07-12 09:11:17
【问题描述】:
我只看到一个与此相关的 SO 问题,并且没有发布任何答案。
我有一个角度应用程序 usnig ag-grid。它使用 cellRendererFramework 为要在表格中显示的列 a 呈现数据。我需要从 Date 列中获取数据以正确格式化 Data 列,但找不到任何方法将其输入渲染器组件。这是基本代码:
// Columns defined inside the main component
this.columnDefs = [
{ headerName: 'Date', field: 'timestamp'},
{ headerName: 'Data',
field: 'type',
cellRendererFramework: MyRendererComponent,
},
}
// Inside the renderer component
export class MyRendererComponent implements OnInit {
myData: any;
agInit(params: import("ag-grid-community").ICellRendererParams): void {
// This is where I need data from the first column to
// properly set the return value
this.myData = this.setUpData(params.value)
}
setUpData(data: any) {
// Operate on the data here, but I need the timestamp to do it properly
}
...
}
有没有人建议我如何将 timestamp 数据放入 MyRendererComponent?
【问题讨论】:
标签: angular ag-grid ag-grid-angular