3 Replies Latest reply on Jul 27, 2007 6:15 PM by sergeysmirnov

    Help with rowspan in rich:dataTable

      Hello,

      I am trying to achieve the following with RichFaces' dataTable:

      <table>
       <tbody>
       <tr>
       <td>This is a time</td>
       <td>This is a title</td>
       </tr>
       <tr>
       <td></td>
       <td>This is a summary</td>
       </tr>
       </tbody>
      </table>


      with the following code:

      <rich:dataTable border="none"
       value="#{allNews}" var="news"
       <rich:column rowspane="2">
       <h:outputText value="#{news.newsTime}" />
       </rich:column>
       <rich:column>
       <h:outputText value="#{news.title}" />
       </rich:column>
       <rich:column breakBefore="true">
       <h:outputText value="#{news.summary}" />
       </rich:column>
      </rich:dataTable>


      But somehow that did not work out.

      Can someone please help.

      BTW, how do I turn off the border on RichFaces' dataTable?

      Thanks
      -tony

        • 1. Re: Help with rowspan in rich:dataTable

          The possible analog is:

          <rich:dataTable
           value="#{allNews}" var="news"
           <rich:column rowspane="2">
           <h:outputText value="#{news.newsTime}" />
           </rich:column>
           <rich:column>
           <h:outputText value="#{news.title}" />
           </rich:column>
           <rich:column breakBefore="true">
           <h:outputText value="" />
           </rich:column>
           <rich:column>
           <h:outputText value="#{news.summary}" />
           </rich:column>
          </rich:dataTable>


          However, I do not understand the point to have the 'empty" column in the second row. May be you wanted to combine those two columns in one?

          border="none" is incorrect even for pure html table. You need to use styles design the desire look-n-feel.

          • 2. Re: Help with rowspan in rich:dataTable

            The only reason I wanted the empty column is I do not know how to align the text in the "newsTime" column to be at the top of the cell and not in the center (height).

            About border, I tried to put the following in my CSS file

            .borderless {
             border: none;
            }


            where borderless is the styleClass of the table:

            <rich:dataTable id="newsTable" styleClass="borderless"
            ...


            But that seems to take only portion of the grid out. Can you shed some light here?

            Thanks
            -tony

            • 3. Re: Help with rowspan in rich:dataTable

               

              "tonylmai" wrote:
              The only reason I wanted the empty column is I do not know how to align the text in the "newsTime" column to be at the top of the cell and not in the center (height).

              Do you know how it might be done in you use simple html table?


              "tonylmai" wrote:

              About border, I tried to put the following in my CSS file
              .borderless {
               border: none;
              }


              where borderless is the styleClass of the table:

              <rich:dataTable id="newsTable" styleClass="borderless"
              ...


              But that seems to take only portion of the grid out. Can you shed some light here?

              Thanks
              -tony


              Of course.
              create a simple html table example and try border="1" and style="border:1px solid black" for table. You can see the following:

              12


              34





              12


              34



              To use style, you need to define it not only for table, but for columns also. I guess, you miss some helpful book about css.