5 Replies Latest reply on Aug 5, 2008 3:02 AM by cash1981

    dataTable inside another dataTable?

    cash1981

      Hello. Can you have a dataTable inside another dataTable?
      I have a two Lists I want to go through, but I want to show the second List inside one of the columns of the first List. Is this possible?

      This is what I have tried to accomplish:

      <rich:dataTable id="personBevhaverResultList" var="pbbList" value="#{personBevhaverResultList}">
      [snip]...[/snip]
      <rich:column align="center">
       <f:facet name="header"><h:outputText value="Alkohol group"/></f:facet>
       <rich:dataTable id="alkoholResultList" border="0" var="baList" value="#{alkoholResultList}">
       <h:outputText value="#{baList.alkoholgroup.name}"/>
      </rich:dataTable>
      </rich:column>
      [snip]...[/snip]
      


      I have also tried a subTable but that didnt work either. This code does not output anything. My column is blank.

        • 1. Re: dataTable inside another dataTable?
          ilya_shaikovsky

          use repeat inside. dataTable inside dataTable will provides wrong html. a4j:repeat has no markup its just iterates data. So place markup you need around it inside the column.

          • 2. Re: dataTable inside another dataTable?
            cash1981

            Thank you. I will try it.

            • 3. Re: dataTable inside another dataTable?
              cash1981

               

              "ilya_shaikovsky" wrote:
              use repeat inside. dataTable inside dataTable will provides wrong html. a4j:repeat has no markup its just iterates data. So place markup you need around it inside the column.


              This worked. Thank you. One final question.
              Since this is inside a dataTable, then I am not sure if I can write another column inside the a4j:repeat so that I can get a line break for each field in the list. How can I do this?

              This code didnt work

              <rich:column align="center">
               <f:facet name="header"><h:outputText value="Alkoholgroup"/></f:facet>
               <a4j:repeat id="alkoholResultList" var="baList" value="#{alkoholResultList}">
               <h:outputText value="#{baList.alkoholgroup.name}"/><br/>
               </a4j:repeat>
              </rich:column>
              


              • 4. Re: dataTable inside another dataTable?
                cash1981

                Sorry for spamming, but I dont know how to edit a post.
                I want to make my self clear. The code DOES work, however the break line does NOT work.

                I would like break line for each item to appear inside the column :-)
                This I need help with. Thank you.

                • 5. Re: dataTable inside another dataTable?
                  cash1981

                  I found it out. This is how to get a line break in inside a4j:repeat

                  <a4j:repeat id="tidsromResultList" var="tidList" value="#{tidsromResultList}">
                  <s:fragment rendered="#{tidList.bevilling.bevillingId == omsetList.bevilling.bevillingId}">
                  <h:outputText value="#{tidList.start} - #{tidList.end}" />
                  <br/>
                  </s:fragment>
                  </a4j:repeat>