7 Replies Latest reply on Oct 15, 2009 1:12 PM by Nick Belaevski

    Custom CSS style for each row in rich:dataTable

    Alex Tracer Newbie

      Greetings!

      I needed to make custom CSS style for each row in a table. So I wrapped my columns in <rich:columnGroup>:

      <rich:dataTable var="item" rowClasses=", evenRow" ...>
       <f:facet name="header">
       <rich:column>
       <h:outputText value="..."/>
       </rich:column>
       </f:facet>
      <!--Added-->
       <rich:columnGroup styleClass="#{item.style}">
      <!--/Added-->
       <rich:column>
       <h:outputText value="..."/>
       </rich:column>
      <!--Added-->
       </rich:columnGroup>
      <!--/Added-->
      
      </rich:dataTable>




      RichFaces generated exactly what I needed: all < tr > elements had
      class="dr-table-firstrow rich-table-firstrow MY_CUSTOM_ROW_STYLE"
      and
      class="dr-table-firstrow rich-table-firstrow evenRow MY_CUSTOM_ROW_STYLE"

      So everything is OK yet.



      However, when I tried to apply same approach on a table with <f:facet name="footer"> inside <rich:column>, footer suddenly disappeared:
      <rich:dataTable var="item" rowClasses=", evenRow" ...>
       <f:facet name="header">
       <rich:column>
       <h:outputText value="..."/>
       </rich:column>
       </f:facet>
      <!--Added-->
       <rich:columnGroup styleClass="#{item.style}">
      <!--/Added-->
       <rich:column>
       <h:outputText value="..."/>
       </rich:column>
       <f:facet name="footer">
       <h:outputText value="..."/>
       </f:facet>
      <!--Added-->
       </rich:columnGroup>
      <!--/Added-->
      
      </rich:dataTable>

      It looks like
      <f:facet name="footer">
       <h:outputText value="..."/>
       </f:facet>

      is completely ignored inside <rich:columnGroup> and I can't understand why it happens.


      Questions:
      1. Is it allowed to use <rich:columnGroup> directly inside <rich:dataTable> (not inside <f:facet name="header">)?
      2. If 1 is Yes what is possible source of footer disappearing?
      3. If 1 is No what is proper way to apply a CSS style for entire row (< tr > element)?


      PS: Sorry for my bad English grammar.