我可以通过将以下 CSS 应用于 AngularJS UI 网格中的行模板来设置行背景颜色:
.deleted {
background-color: #e3e3e3 !important;
}
效果很好。但是,当我添加
text-decoration: line-through !important;
它不适用于行内的文本。我做错了什么?
最佳答案
看起来我不必要地添加了这种样式:
.ui-grid-row .ui-grid-cell {
background-color: inherit !important;
}
为了获得预期的效果,我只需按以下方式更改行模板:
$scope.gridOptions= {
rowTemplate: '<div>'+
'<div ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name" ' +
'class="ui-grid-cell" ' +
' ng-class="{ \'ui-grid-row-header-cell\': col.isRowHeader, deleted: row.entity.deleted}" ui-grid-cell></div></div>'}
deleted: row.entity.deleted 是设置我的类的条件。
关于css - Angular-ui-grid - 文本装饰不适用于行模板子项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54274667/