我目前正試圖在agGrid標題中添加一個角度指令。對於我在headerCellRenderer傳遞的函數如下:agGrid:自定義標題列綁定不起作用
我gridOptions:
this.columnDefs = [
{headerName: "Height", field: "rowHeight"},
{headerName: "Athlete", field: "athlete", width: 180},
{headerName: "Age", field: "age", width: 90},
{headerName: "Country", field: "country", width: 120},
{headerName: "Year", field: "year", width: 90}
];
this.gridOptions = {
columnDefs: this.columnDefs,
rowData: null,
//enableSorting: true,
headerHeight: 60,
//enableFilter: true,
enableColResize: true,
angularCompileRows:true,
angularCompileHeaders: true,
headerCellRenderer: (params) =>
{return this.headerCellRendererFunc(params);},
rowSelection: 'multiple',
};
我的函數的定義如下:
headerCellRendererFunc(params) {
const headerColDef = params.colDef;
headerColDef.name = headerColDef.headerName;
headerColDef.isMetadata = false;
return '<header column="headerColDef"></header>';
}
由於我的指令被渲染的結果,但「列「綁定是空的,我不明白我必須如何將對象傳遞給我的指令。
任何想法? 謝謝!
奇怪當我通過像虛值: '<數據網格報頭柱= 「 '+ CA +'」>數據網格報頭>'; 「ca」是一個數字,這個數字有效地符合我的指示... – Dzu