【发布时间】:2019-10-15 00:11:26
【问题描述】:
我正在尝试在 ag-grid 表格单元格中添加一个简单的组件。我在 agggrid 网站上显示说明,但它不会渲染组件。这是我的代码:
columnDefs = [
{ headerName: "Name", field: "name" ,width: 400},
{ headerName: "GoodsFinalCode", field: "goodsFinalCode" ,width: 200},
{ headerName: "operation", field: "operation" ,cellRendererFramework: OperationComponent, width: 450}
];
rowData = [ {
name : 'b',
goodsFinalCode :6,
}
]
网格选项是:
this.gridOptions = <GridOptions>{
rowData: this.rowData,
columnDefs: this.columnDefs,
context: {
componentParent: this
},
enableColResize: true
};
组件是:
import { Component } from '@angular/core';
@Component({
selector: 'app-operation',
templateUrl: './operation.component.html',
styleUrls: ['./operation.component.scss']
})
export class OperationComponent {
private params: any;
agInit(params: any): void {
this.params = params;
}
}
在操作html中我只有一个按钮。但 agggrid 单元格中没有出现任何内容。
【问题讨论】:
标签: angular ag-grid-angular cellrenderer