2017-12-15 7 views
0

グリッドの最初の編集可能なセルにフォーカスを設定しようとしていますが、このエラーが発生しています "TypeError:未定義の 'setFocusedCell'プロパティを読み取れません。ag-grid ngOnInitでフォーカスされたセルを設定できません

私はag-grid-angularコンポーネントのngOnInitでsetFocusedCellを呼び出しています。ここでは抜粋です。

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 
     } 
    ]; 
} 

答えて

0

代わりngOnInitでsetFocusedCellを呼び出すのでは、onGridReadyでそれを呼び出す(gridReady)

関連する問題