【问题标题】:how to change cell value of custom dynamic column in ag-grid如何更改 ag-grid 中自定义动态列的单元格值
【发布时间】:2016-10-15 09:50:24
【问题描述】:

我像这样向 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();

【问题讨论】:

    标签: ag-grid


    【解决方案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") ... ... ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-31
      • 2020-09-25
      • 2019-08-06
      • 1970-01-01
      • 2016-08-04
      • 2022-11-05
      • 1970-01-01
      • 2017-10-25
      相关资源
      最近更新 更多