2 Replies Latest reply on Apr 2, 2012 12:55 PM by Cristian Slav

    extendedDataTable - multiple row header

    Cristian Slav Newbie

      Hi,

       

      I have a problem using extendedDataTable - my appologies if the question sounds stupid but I'm a newbe to RichFaces

      My problem is that I am trying to create a table using extendedDataTable which has a header which is spanning on two rows but the header is rendered on only one row. Here is a simplified example:

       

       

       

      <rich:extendedDataTable value="#{sessionCtrl.displayCtrl.viewedDates}" var="date" style=""> 
          <f:facet name="header">
              <rich:columnGroup>
                  <rich:column rowspan="2">
                      <h:outputText value="#{bundle.Date}" />
                  </rich:column>
                   <rich:column colspan="2">
                      <h:outputText value="big" />
                  </rich:column>
                  <rich:column breakRowBefore="true">
                      <h:outputText value="small 1" />
                  </rich:column>
                  <rich:column breakRowBefore="true">
                      <h:outputText value="small 2" />
                  </rich:column>
              </rich:columnGroup>
          </f:facet>
      
          <rich:column>
              <h:outputText value="#{date}"/>
          </rich:column>
      </rich:extendedDataTable>
      
      
      

       

       

        • 1. Re: extendedDataTable - multiple row header
          Brendan Healey Master

          Hi Cristian, a good question. I've not managed to get the header to span more than one row but have got

          individual column headers to appear on more than one line using either of the following options:

           

          <f:facet name="header">

             <h:outputText escape="false" value="hello&lt;br/&gt;world"/>

          </f:facet>

           

          <f:facet name="header">

             <h:outputText style="white-space: pre" value="hello&#10;world"/>

          </f:facet>

           

          In the first example if you are getting the text from a resource file then you could have this:

           

          messages.properties

          helloWorldText=hello<br/>world

           

          <f:facet name="header">

            <h:outputText escape="false" value="#{msgs.helloWorldText}"/>

          </f:facet>

           

          What I wasn't able to do was get everything vertical-align: middle - everything ends up vertical-align: top, I

          expect that the line break confuses things.

           

          So, perhaps not exactly what you wish to do but it does at least mean that you don't have to have a column

          taking up half the page width just because the column header consists of multiple words!

           

          Regards,

          Brendan.

           

          p.s. I don't think I've got any additional css applied to the table and it's header but it's not impossible, so if

                 you don't get a multi-line header with the above let me know and I'll double check.

          • 2. Re: extendedDataTable - multiple row header
            Cristian Slav Newbie

            Hi Brendan,

             

            thanks for the reply. Actually, what I want to obtain is a table with a header like this:

             

            header_example.jpg

             

            It works quite well in dataTable but because I have a large table I would like to use extendedDataTable.

             

            Best regards,

            Cristi