How to conditionally style a row in a rich:dataTable

后端 未结 7 1467
攒了一身酷
攒了一身酷 2021-02-07 02:12

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

相关标签:
7条回答
  • 2021-02-07 02:53

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

    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.

    EDIT: (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??

    Eg.

    <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>
    
    0 讨论(0)
提交回复
热议问题