1 Reply Latest reply on May 4, 2007 5:33 PM by sergeysmirnov

    is dynamic creation of richTable possible?

    mkaliyur

      This is not a bug. May be a desirable feature .

      Can I do this?

      
      <rich:dataTable width="100%"
      binding="#{MappEnvService.richUItable}" value="#{tab.tabData}"
      var="rows">
      <f:facet name="header">
      <rich:columnGroup>
      <c:forEach items="#{tab.headerData}" var="hcol">
      <rich:column>
      <h:outputText value="#{hcol.colHeader}"></h:outputText>
      </rich:column>
      </c:forEach>
      </rich:columnGroup>
      </f:facet>
      <c:forEach items="#{tab.Data[0].columnField}" var="columns">
      <rich:column>
      <h:outputText value="#{columns.data}"></h:outputText>
      </rich:column>
      </c:forEach>
      </rich:dataTable>
      


      Basically the data about the rich:columns should come from an arraylist which gets pouplated before page is called - the number of columns in table is not known at page authoring stage.

      The above code works only for the header - it renders the headers dynamically. But for column childern, it doesnt seem to evaluate the forEach loop.

      Currently I'm using binding attribute to bind to a backend support bean which creates the rich columns and adds to the table - but this approch is not desirable as program needs to be aware of the exact jsf components used etc - the whole flexibility of jsf templates are lost.

      Is there is a way to accomplish this with rich:table component?

      Thanks!
      M