如何在rich:dataTable中有条件地设置行样式 [英] How to conditionally style a row in a rich:dataTable

查看:96
本文介绍了如何在rich:dataTable中有条件地设置行样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何根据条件更改特定行的样式?我可以在rich:column样式类属性中使用JSF EL,但是我必须为每一列编写代码.我要更改整行.

How can I change the style of a particular row based on a condition? I can use JSF EL in rich:column style class attribute, but I have to write for each column. I want to change the entire row.

谢谢

推荐答案

我按照您已经提到的方法进行操作,并将样式放在列中.

I do as you've already mentioned and put the style on the column.

但是,您始终可以尝试将所有列包装在<rich:columnGroup>中,该输出应该输出<tr>并在其上放置条件样式.

However you could always try wrapping all of your columns in a <rich:columnGroup> which is supposed to output a <tr> and place your conditional style on that.

(响应评论):如果列中的标题面已损坏,则也可以将其分成一个列组.应该可以工作-您甚至可能不需要标题中的列组?

(in response to comment): if the header facets in your columns are being broken then you can separate them into a column group as well. Should work - you may not even need the column group in the header??

例如.

<rich:dataTable>
  <f:facet name="header">
    <rich:columnGroup>
      <rich:column>Header 1</rich:column>
      <rich:column>Header 1</rich:column>
    </rich:columnGroup>
  </f:facet>
  <rich:columnGroup>
    <rich:column>Data</rich:column>
    <rich:column>Data</rich:column>
  </rich:columnGroup>
</rich:dataTable>

这篇关于如何在rich:dataTable中有条件地设置行样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆