8 Replies Latest reply on Aug 22, 2008 2:31 AM by vlad.kamensky

    dymanically create datatable and column

    Andy Shiue Newbie

      Hi all,

      I want to dymanically create tables and within each table I also dymanically create columns.

      I am not sure if I am implementing it the correct way.
      The following is my html code:

      <a4j:repeat value="#{testlist}" var="tlist">
      <rich:dataTable value="#{tlist}" var="t" border="1" width="450"
       <f:facet name="header">
       <h:outputText value="#{tlist.name}" /> </f:facet>
       <f:facet name="header">
       <h:outputText value="Date" /> </f:facet>
       <a4j:repeat value="#{tlist.params}" var="p">
       <f:facet name="header">
       <h:outputText value="p.paramname" /> </f:facet>

      The testlist is a list of test:
      public class Test {
       private String name;
       private List<ParamColumn> params;
       public String getName() {return name;}
       public void setName(String name) { this.name = name; }
       public List<ParamColumn> getParams() {return params;}
       public void setParams(List<ParamColumn> params) {this.params=params;}

      And for the ParamColumn :
      public class ParamColumn {
       String paramname;
       public String getParamName() { return paramname; }
       public void setParamName(String param) { this.paramname=param; }

      The result is a list of tables with correct header but only one column "Date" and didn't create any other columns with paramname as header.

      Is it possible to do it?
      Thanks for any suggestions in advance!!