Bahgat Mashaly
Bahgat Mashaly

Reputation: 510

how to change cell value of custom dynamic column in ag-grid

i added custom column to ag-grid like this

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

how to change a cell value of this column in runtime ?

i tried this solution but not work

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

});

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

Upvotes: 1

Views: 7703

Answers (1)

Bahgat Mashaly
Bahgat Mashaly

Reputation: 510

the answer

  • first put the field name like this
 this.columnDefs.push(
            {headerName: "Action Status",field:"actionStatus", cellStyle:{"text-align":"center"} })

-set new value like this

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

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

Upvotes: 4

Related Questions