2 Replies Latest reply on Apr 21, 2010 11:01 AM by Tim Foster

    Table with two rows of header and sort on one column

    Tim Foster Newbie

      Question from a newbie.  I have a screen where I need to display a table with the header split onto two rows and the data will be in two rows and sortby on one of the columns.

       

      What it would look like is below (ignore the header column on the table) and would want to be able to sort the table by age

       

      Header 1Header 2Header 3
      header row 1 nameagegender
      header row continued on next line heightweighthair color
      first row of data John30male
      6 feet200 lbsbrown
      second row of data Mary30female
      5 feet125 lbsred


      The data displays ok in the solution I have now but once I put the sortby attribute on the age column it ends up creating a third row of header for the sort icon and in my example above it would put it under the weight header.  What I have to display the table is very similar to the following example from the documentation but again when I put the sortby I have to put it on the h:outputText instead of the header column and this causes

      the third row of header. What I would like is for the sort icon to be displayed with the header age.  Anyone know how to do that.  A table with two header rows and sortby one of the columne?

       

       

      <rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5" id="sublist">
      <f:facet name="header">
      <rich:columnGroup>
      <rich:column rowspan="2">
      <h:outputText value="State Flag"/>
      </rich:column>
      <rich:column colspan="3">
      <h:outputText value="State Info"/>
      </rich:column>
      <rich:column breakBefore="true">
      <h:outputText value="State Name"/>
      </rich:column>
      <rich:column>
      <h:outputText value="State Capital"/>
      </rich:column>
      <rich:column>
      <h:outputText value="Time Zone"/>
      </rich:column>
      </rich:columnGroup>
      </f:facet>
      <rich:column>
      <h:graphicImage value="#{cap.stateFlag}"/>
      </rich:column>
      <rich:column>
      <h:outputText value="#{cap.state}"/>
      </rich:column>
      <rich:column>
      <h:outputText value="#{cap.name}"/>
      </rich:column>
      <rich:column>
      <h:outputText value="#{cap.timeZone}"/>
      </rich:column>
      </rich:dataTable>

       

      thanks in advance for all help