2 Replies Latest reply on Feb 13, 2009 10:00 PM by jinpsu

    subTable rendering problem

      I've created a small example of my problem. The dataTable displays a list of Person objects that contain a Mother, Father, and list of Children. I'm using a subTable to display the children, but it's not rendering correctly. What am I doing wrong?

       <rich:dataTable var="person" value="#{testBean.people}">
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Mother"/>
       </f:facet>
       </rich:column>
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Father"/>
       </f:facet>
       </rich:column>
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Children"/>
       </f:facet>
       </rich:column>
       <rich:subTable rendered="#{empty person.children}">
       <rich:column>
       <h:outputText value="#{person.mother}"/>
       </rich:column>
       <rich:column>
       <h:outputText value="#{person.father}"/>
       </rich:column>
       <rich:column>
       <h:outputText value="No Children"/>
       </rich:column>
       </rich:subTable>
       <rich:subTable value="#{person.children}" var="child" rowKeyVar="childIdx">
       <rich:column rowspan="#{fn:length(person.children)}" rendered="#{childIdx == 0}">
       <h:outputText value="#{person.mother}"/>
       </rich:column>
       <rich:column rowspan="#{fn:length(person.children)}" rendered="#{childIdx == 0}">
       <h:outputText value="#{person.father}"/>
       </rich:column>
       <rich:column>
       <h:outputText value="#{child}"/>
       </rich:column>
       </rich:subTable>
       </rich:dataTable>
      


      The code above does not render correctly. The dataTable tacks on two incompletely rendered (and empty) columns and an additional emtpy row. The first subTable doesn't render at all (no children).

        • 1. Re: subTable rendering problem
          nbelaevski

          Hello,

          The same problem as here: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=150228. Empty rows are coming from rich:column elements, you can just hide them as a workaround:

          <style type="text/css">
           .hidden {
           display: none;
           }
           </style>
          
           <rich:dataTable var="person" value="#{forum5Bean.persons}" rowKeyVar="rk" rowClasses="hidden">
           <rich:column colspan="1">
           <f:facet name="header">
           <h:outputText value="Mother"/>
           </f:facet>
           </rich:column>
           <rich:column colspan="1">
           <f:facet name="header">
           <h:outputText value="Father"/>
           </f:facet>
           </rich:column>
           <rich:column colspan="1">
           <f:facet name="header">
           <h:outputText value="Children"/>
           </f:facet>
           </rich:column>
           <rich:subTable rendered="#{empty person.children12}" value="#{person}">
           <rich:column>
           <h:outputText value="#{person.mother}"/>
           </rich:column>
           <rich:column>
           <h:outputText value="#{person.father}"/>
           </rich:column>
           <rich:column>
           <h:outputText value="No Children"/>
           </rich:column>
           </rich:subTable>
           <rich:subTable rendered="#{not empty person.children12}" value="#{person.children12}" var="child" rowKeyVar="childIdx">
           <rich:column rowspan="#{fn:length(person.children12)}" rendered="#{childIdx == 0}">
           <h:outputText value="#{person.mother}"/>
           </rich:column>
           <rich:column rowspan="#{fn:length(person.children12)}" rendered="#{childIdx == 0}">
           <h:outputText value="#{person.father}"/>
           </rich:column>
           <rich:column>
           <h:outputText value="#{child}"/>
           </rich:column>
           </rich:subTable>
           </rich:dataTable>



          • 2. Re: subTable rendering problem

            Thanks!! That worked great.