Search code examples
angularag-gridag-grid-ng2

Is there a way in angular to update the rowData when value changes inside a cellRendererComponent, when using ag-grid-angular


I have a column definition as following:

    colDef = [{
       headerName: 'Cell ID',
       field: 'cellId',
       cellRendererFramework: CellIdCellRendererComponent,
    },
    {
       headerName: 'Set ID',
       field: 'cellId'
       cellRendererFramework: SetIdCellRendererComponent,
    }]

Within the cellIdCellRendererComponent, I'm trying to update the entire RowData as below:

this.params.api.updateRowData(this.params.data);

Solution

  • I'm trying to update another cell value, in the first cell I have a dropdown, and based on the selection of value in dropdown, I have to update the values of dropdown in next column.

    So you just need to use setDataValue method

    params.node.setDataValue(anotherCell, anotherCellNewValue):