row style ag grid code example
Example: how to use getRowStyle to change backgroud color in ag grid
gridOptions.rowStyle = { background: 'black' };
gridOptions.getRowStyle = function(params) {
if (params.node.rowIndex % 2 === 0) {
return { background: 'red' };
}
}
getRowStyle: (params: any) => {
if (params.node.data !== undefined) {
const debugLevel = params.node.data.Level;
switch (debugLevel) {
case "INFO":
return { background: '#85C1E9' };
case "WARN":
return { background: '#EB984E' };
case "ERROR":
return { background: '#E74C3C' };
default:
break;
}
}
}