【发布时间】:2018-05-29 22:00:31
【问题描述】:
我正在尝试将焦点设置到网格中的第一个可编辑单元格并收到此错误“TypeError: Cannot read property 'setFocusedCell' of undefined”。
我在我的 ag-grid-angular 组件中的 ngOnInit 中调用 setFocusedCell。这是一个sn-p:
constructor(private mcService: MonteCarloService) {
this.gridOptions = <GridOptions>{
rowData: MCInputGridComponent.createRowData(),
columnDefs: MCInputGridComponent.createColumnDefs()
};
}
ngOnInit() {
this.gridOptions.api.setFocusedCell(1, "histDataType", null);
}
我已经定义了列并通过构造方法设置了一些数据。以下是列定义。
private static createColumnDefs() {
return [
{
colKey: "sprint#",
headerName: "Sprint #",
field: "sprint",
width: 80,
editable: false
},
{
colKey: "histDataType",
headerName: "Velocity",
field: "histDataType",
cellEditorFramework: NumericEditorComponent,
editable: true,
width: 102
}
];
}
【问题讨论】:
标签: ag-grid