[Fixed] Ag-grid how to update cell style by clicking a button


I have a button on top of my grid and I want to update cell style depending on cell value once clicked. I have something working but it updates all columns and not specific cell. How can I update/target specific cell when I click on the button.

updateCellStyle(){ this.gridApi.getColumnDef(column).cellStyle = { border: '1px solid #165a9f' }}


I have’nt tested but I believe its something like this; set buttonClicked to true on button click.

const gridOptions = {
    context: {
        buttonClicked: false

In the columnDef:

cellStyle: params => params.context.buttonClicked && params.value > 80 ? 
    { border: '1px solid #165a9f' } : { border: 'whatever it is before the button is clicked' }

Leave a Reply

(*) Required, Your email will not be published