2 Replies Latest reply on Jul 17, 2007 5:42 PM by tonylmai

    Breaking columns in RichFaces' dataTable with colspan and ro

      Hello all,

      I am trying to break up columns within RichFaces' dataTable using breakBefore attribute. Here is what I'd like to achieve:

      <thead>
       <tr>
       <th rowspan="2">Column A</th>
       <th rowspan="2">Column B</th>
       <th colspan="3">Grouping A</th>
       <th colspan="3">Grouping B</th>
       <th rowspan="2">Column I</th>
       </tr>
       <tr>
       <th>Column C</th>
       <th>Column D</th>
       <th>Column E</th>
       <th>Column F</th>
       <th>Column G</th>
       <th>Column H</th>
       </tr>
      </thead>


      I tried the following code:

      <rich:dataTable
       onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
       cellpadding="0" cellspacing="0" border="0"
       var="p" value="#{wcP}">
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column rowspan="2">Column A</rich:column>
       <rich:column rowspan="2">Column B</rich:column>
       <rich:column colspan="3">Grouping A</rich:column>
       <rich:column breakBefore="true">Column C</rich:column>
       <rich:column>Column D</rich:column>
       <rich:column>Column E</rich:column>
       <rich:column colspan="3">Grouping B</rich:column>
       <rich:column breakBefore="true">Column F</rich:column>
       <rich:column>Column G</rich:column>
       <rich:column>Column H</rich:column>
       <rich:column>Column I</rich:column>
       </rich:columnGroup>
       </f:facet>


      I need column marking with Grouping B to be on the top row and I am not sure how to do that. Currently this column is rendered in the second row (due to previous breakBefore marking used in Column C.

      Can someone help?

      Thanks
      -tony

        • 1. Re: Breaking columns in RichFaces' dataTable with colspan an

          Hmm. Why you just did not repeat exactly what you have in the original html mockup. As I see, you have only two rows, so you have to have only one breakBefore to make a replica.





          Column A
          Column B
          Grouping A
          Grouping B
          Column I


          Column C
          Column D
          Column E
          Column F
          Column G
          Column H



          <thead>
           <tr>
           <th rowspan="2">Column A</th>
           <th rowspan="2">Column B</th>
           <th colspan="3">Grouping A</th>
           <th colspan="3">Grouping B</th>
           <th rowspan="2">Column I</th>
           </tr>
           <tr>
           <th>Column C</th>
           <th>Column D</th>
           <th>Column E</th>
           <th>Column F</th>
           <th>Column G</th>
           <th>Column H</th>
           </tr>
          </thead>


          reproduces with:

          <f:facet name="header">
           <rich:columnGroup>
           <rich:column rowspan="2">Column A</rich:column>
           <rich:column rowspan="2">Column B</rich:column>
           <rich:column colspan="3">Grouping A</rich:column>
           <rich:column colspan="3">Grouping B</rich:column>
           <rich:column rowspan="2">Column I</rich:column>
           <rich:column breakBefore="true">Column C</rich:column>
           <rich:column>Column D</rich:column>
           <rich:column>Column E</rich:column>
           <rich:column>Column F</rich:column>
           <rich:column>Column G</rich:column>
           <rich:column>Column H</rich:column>
           </rich:columnGroup>
           </f:facet>


          As you see, breakBefore replaces "< /tr >< tr >" and that is it.

          • 2. Re: Breaking columns in RichFaces' dataTable with colspan an

            I see. That worked well.

            Thanks again SS.