I need to change the background color of an angular ui-grid row based on a condition. If the riskValue is 1, I want the row to be red, and if the value is 2, the row background color should be yellow. Is there an easy way to accomplish this task?
config.js
"columnDefs": [{
"name": "Ticket Number",
"field": "ticketNum",
"width": 120
},
{
"name": "Asset Id ",
"field": "assetID",
"width": 100
},
{
"name": "Severity",
"field": "severity",
"width": 100
},
{
"name": "Risk Index",
"field": "riskIndex",
"width": 100
},
{
"name": "Risk Val",
"field": "riskValue",
"cellTemplate": "<div ng-if=\"row.entity.Comments_Col1 != 'none'\" title={{row.entity.riskValue}} \" ><div style='white-space:nowrap;border-bottom: 1px solid red !important; height:100%;width:100%;background-color:{{row.entity.riskValue == 1 ? 'red' : row.entity.riskValue == 2 ? 'yellow' : 'white'}}'>{{row.entity.riskValue}}</div></div>",
"sort": {
"direction": "aesc",
"priority": 0
},
"width": 100,
"visible": false
}
],