更新时间:2023-01-25 21:01:22
您也可以将css类添加到行和列中,以标识一个单元格.
使用dataTable的rowStyleClass
属性(示例).
如果要为多行着色:
You can add a css class to the row and to the column too, that identifies a cell.
Use the dataTable's rowStyleClass
attribute (example).
If you want to color multiple rows:
<p:dataTable value="#{bean.rows}" var="rowVar"
rowStyleClass="#{rowVar.firstCol gt 0 ? 'firstColColored' : ''}
#{rowVar.secondCol gt 0 ? 'secondColColored' : ''}">
<p:column styleClass="firstCol">...
<p:column styleClass="secondCol">
css:
.firstColColored .firstCol {
background: pink;
}