1 Reply Latest reply on Oct 10, 2007 10:41 AM by Ivan Tufegdzic

    Dynamic columns in DataTable and manual row break

    Krzysztof Bilinski Newbie

      I have a little complicated table model. The header should look like this:

      ---------- --------------------- --------------------- ... ---------------------
      static | c1r1 | c2r1 |...| cNr1 |
       -------- ... -------- -------- ... -------- ... -------- ... --------
      column | c1r2 |...| cMr2 |c(M+1)r2|...| etc |...| etc |...| etc |
      ---------- --------------------- --------------------- ... ---------------------


      There is dynamic number of columns in top row and in the second row, for each top column there is also different number of columns. It would be easy if I could manually break a row, but the only possibility I see is using "breakBefore=true". Unfortunatelly I cannot use it in "c:forEach" tag.

      <f:facet name="header">
       <rich:columnGroup>
       <rich:column rowspan="2">
       <h:outputText value="Head 2 rows" />
       </rich:column>
       <c:forEach items="#{bean.getHeadRow1()}" var="row1col">
       <rich:column colspan="#{bean.getHeadRow2(row1col).size() + 1}">
       <h:outputText value="#{row1col.name}" />
       </rich:column>
       </c:forEach>
      
       // I need to manually break row here, but how??
      
       <c:forEach items="#{bean.getHeadRow1()}" var="row1col">
       <c:forEach items="#{bean.getHeadRow2(row1col)" var="row2col">
       <rich:column>
       <h:outputText value="#{row2col.name}" />
       </rich:column>
       </c:forEach>
       </c:forEach>
       </rich:columnGroup>
      </f:facet>


      Maybe someone have already solved similiar problem and could share the solution.

      Thanks,
      Chris