2017-05-15 9 views
0

同じ値で列全体を編集したいと思います。角2 +グリッド/列全体を編集

私はこのようになります私のAG-グリッド持っている:私はやりたい何image of the grid

arrêtéに列Etatのすべての値を変更することですが、私はそれが今のために働くことはできません。

は、そして、これは私が試したものと私のコードです:私はボタンをクリックしたときに

private gridOptions: GridOptions; 
public rowData: any[]; 

constructor() { 
    this.stopTrains(); 
    this.gridOptions = {}; 
    this.gridOptions.columnDef = [ 
     ... 
     { 
      headerName: 'Etat', 
      field: 'etat', 
      ... 
      editable: true 
     } 
     ... 
    ]; 
} 

stopTrains() { 
    var rowData: any[] = []; 
    rowData.push({ 
     etat: 'arrêté' 
    }) 
    this.rowData = rowData; 
} 

stopTrains()が呼び出されます。

stopTrains() { 
    //loop through current row data and set the etat key to 'arrêté' 
    this.gridOptions.api.forEachNode(params=>params.data.etat = 'arrêté') 
    //refresh the view so that the changes take effect 
    this.gridOptions.api.refreshView() 
} 

あなたはまた、唯一のグリッド内の可視ノードが変更されるforEachNodeAfterFilterを使用することができます。

答えて

関連する問題