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
を使用することができます。
私は感謝、forEachNode'、それが完璧に動作し 'てみました! – UserName