如何在ag-grid中更改自定义动态列的单元格值

时间:2016-06-14 15:07:51

标签: ag-grid

我将自定义列添加到ag-grid,就像这样

 this.columnDefs.push( {headerName: "Action Status", cellStyle:{"text-align":"center"}});

如何在运行时更改此列的单元格值?

我试过这个解决方案但没有工作

this.gridOptions.api.forEachNodeAfterFilterAndSort(function (rowNode:RowNode) {
   rowNode.columnController.originalColumns[1].colDef.headerCellTemplate="test"

});

      this.gridOptions.api.softRefreshView();
        this.gridOptions.api.refreshView();

1 个答案:

答案 0 :(得分:1)

答案

  • 首先输入这样的字段名称
 this.columnDefs.push(
            {headerName: "Action Status",field:"actionStatus", cellStyle:{"text-align":"center"} })

- 设置像这样的新值

this.gridOptions.api.forEachNodeAfterFilterAndSort(function (rowNode:RowNode) {

            rowNode.setDataValue("actionStatus","the new value") ... ... ...