我試圖執行這個Ag Grid for Angular CLI,我已經按照他們在文檔中提到的每一個步驟操作,但Value列是空的並且不顯示數據。我在控制檯中看到沒有錯誤。我試圖調試,但沒有運氣。請幫助Ag Grid not display data
請告訴我,我做錯了
MyGridApplicationComponent
import {
Component,
OnInit
} from '@angular/core';
import {
GridOptions
} from "ag-grid";
import {
RedComponentComponent
} from "../red-component/red-component.component";
@Component({
selector: 'app-my-grid-application',
templateUrl: './my-grid-application.component.html',
styleUrls: ['./my-grid-application.component.css']
})
export class MyGridApplicationComponent {
private gridOptions: GridOptions;
constructor() {
this.gridOptions = <GridOptions> {};
this.gridOptions.columnDefs = [{
headerName: "ID",
field: "id",
width: 200
},
{
headerName: "Value",
field: "value",
cellRendererFramework: RedComponentComponent,
width: 200
},
];
this.gridOptions.rowData = [{
id: 5,
value: 10
},
{
id: 10,
value: 15
},
{
id: 15,
value: 20
}
]
}
}
RedComponentComponent
import {
Component
} from "@angular/core";
@Component({
selector: 'app-red-component',
templateUrl: './red-component.component.html'
})
export class RedComponentComponent {
private params: any;
agInit(params: any): void {
this.params = params;
}
}