【发布时间】:2018-04-01 19:28:13
【问题描述】:
我正在尝试根据条件更改有角 ui-grid 行的背景颜色,因此如果 riskValue 为 1,则尝试使其变为红色,如果值为 2,则行背景颜色应为黄色。有什么简单的方法可以完成这项任务吗?
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%;'>{{row.entity.riskValue}}</div></div>",
"sort": {
"direction": "aesc",
"priority": 0
},
"width": 100,
"visible": false
}
],
【问题讨论】:
-
不会添加诸如“background-color”之类的行:#2dff07 work?
标签: javascript css angularjs angular-ui-grid