I'm struggling to dynamically change the background color of a row in an ag-grid table when it is clicked. I have attempted using getRowStyle and getRowClass, but those methods only work when the table is initially loaded. I then tried utilizing onrowClicked, but that approach has not been successful.
onRowClicked : row => {
if (row.data.hasNewData) {
return { background: '#ff9998 !important'};
} else if (row.data.hasWrongData === 'Yes') {
return { background: '#f5ff8b !important' };
} else if (row.data.hasNoData) {
return { background: '#acff93 !important' };
}
}
I am aiming for the row's background color to update upon clicking based on various data parameters.