如何根据作为文本的单元格值在 ng-grid 中设置行颜色?
How to set row color in ng-grid based on a cell value which is a text?
我指的是这个 plunkr:http://plnkr.co/edit/X4SqsjGtlDOJQrkrYWv6?p=preview
如果 pedido 是 "A001",我想将一行的颜色设置为绿色。
我应该怎么做?
我尝试更改 **ng-class,但似乎不起作用,因为它是 "A001"
如果我必须更改其他内容,请告诉我
var rowTemplate = `
<div style="height: 100%"
ng-class="{red: row.getProperty('\pedido\') == C003,
green: row.getProperty('\pedido\') == A001}">
<div ng-style="{'cursor': row.cursor }"
ng-repeat="col in renderedColumns"
ng-class="col.colIndex()" class="ngCell ">
<div class="ngVerticalBar" ng-style="{height: rowHeight}"
ng-class="{ ngVerticalBarVisible: !$last }">
</div>
<div ng-cell>
</div>
</div>
</div>
`;
总是设置 class = A001
您应该将 = 更改为 ==
green: row.getProperty(\'pedido\') = A001
改为
green: row.getProperty(\'pedido\') == \'A001\'
我指的是这个 plunkr:http://plnkr.co/edit/X4SqsjGtlDOJQrkrYWv6?p=preview 如果 pedido 是 "A001",我想将一行的颜色设置为绿色。 我应该怎么做? 我尝试更改 **ng-class,但似乎不起作用,因为它是 "A001"
如果我必须更改其他内容,请告诉我
var rowTemplate = `
<div style="height: 100%"
ng-class="{red: row.getProperty('\pedido\') == C003,
green: row.getProperty('\pedido\') == A001}">
<div ng-style="{'cursor': row.cursor }"
ng-repeat="col in renderedColumns"
ng-class="col.colIndex()" class="ngCell ">
<div class="ngVerticalBar" ng-style="{height: rowHeight}"
ng-class="{ ngVerticalBarVisible: !$last }">
</div>
<div ng-cell>
</div>
</div>
</div>
`;
总是设置 class = A001 您应该将 = 更改为 ==
green: row.getProperty(\'pedido\') = A001
改为
green: row.getProperty(\'pedido\') == \'A001\'