我使用AG-GRID API來填充表在我的網站下的文件main.ts我已經加入如下代碼AG-網格單元的渲染誤差
import { bootstrap } from 'angular2/platform/browser';
import { AppComponent } from './app.component';
import { ROUTER_PROVIDERS } from 'angular2/router';
import { AgGridModule } from 'ag-grid-ng2/main';
bootstrap(AppComponent, [ROUTER_PROVIDERS],AgGridModule);
我的主要component.ts文件如下
import { Component } from 'angular2/core';
import { GridOptions } from 'ag-grid/main';
@Component({
moduleId: module.id,
templateUrl:"app/grid.component.html";
})
export class gridComponent{
public gridOptions:GridOptions;
constructor() {
this.gridOptions = <GridOptions>{};
this.gridOptions.rowData = this.createRowData();
this.gridOptions.columnDefs = this.createColumnDefs();
}
private onCellValueChanged($event) {
this.gridOptions.api.refreshCells([$event.node],["cube"]);
}
private createColumnDefs() {
return [
{headerName: "Row 1", field: "row", width: 140}
];
}
public refreshRowData() {
let rowData = this.createRowData();
this.gridOptions.api.setRowData(rowData);
}
private createRowData() {
let rowData:any[] = [];
for (var i = 0; i < 15; i++) {
rowData.push({
row: "Name" + i
});
}
console.log(rowData);
return rowData;
}
}
當我編譯我得到一個錯誤的模塊找不到。 誰能幫助 在此先感謝
你有沒有加入它的申報程序.module.ts? –