3 Replies Latest reply on Nov 20, 2007 9:51 AM by inv3r53 d

    Datatable and a:repeat?

    Tomislav Tkal?evi? Novice

      Hy to all!
      I need to do something like variable columns,
      so i have tried on datatable put a:repeat..

      This is my jsp page

      <r:dataTable id="tablica2" var="v" rowKeyVar="rb" value="#{test.data.rows}">
       <f:facet name="header">
       <r:columnGroup id="grupaKolonaZaglavlje">
       <a:repeat value="#{test.data.columns}" var="c">
       <r:column>
       <t:outputText value="#{c}"/>
       </r:column>
       </a:repeat>
       </r:columnGroup>
       </f:facet>
       <a:repeat value="#{v}" var="r">
       <r:column>
       <t:outputText value="#{r}" />
       </r:column>
       </a:repeat>
      </r:dataTable>
      


      This is class which holds the data

      package orka.core.test;
      
      import java.util.List;
      import java.util.Vector;
      
      public class Data {
      
       private List<String> columns = new Vector<String>();
      
       private List<String> rows = new Vector<String>();
      
       public List<String> getColumns() {
       return columns;
       }
      
       public void setColumns(List<String> columns) {
       this.columns = columns;
       }
      
       public List<String> getRows() {
       return rows;
       }
      
       public void setRows(List<String> rows) {
       this.rows = rows;
       }
      }
      



      And i (in some test bean) load some data in data holder class


      package orka.core.test;
      
      import org.jboss.seam.annotations.Create;
      import org.jboss.seam.annotations.Name;
      
      @Name("test")
      public class TestDatatable{
      
       Data data = new Data();
      
       @Create
       public void create(){
       pp.getColumns().add("Name");
       pp.getColumns().add("Surname");
       pp.getColumns().add("Adress");
      
       pp.getRows().add("Tomislav");
       pp.getRows().add("Tkalcevic");
       pp.getRows().add("D.F Kozarac");
      
       pp.getRows().add("Josip");
       pp.getRows().add("Tkalcevic");
       pp.getRows().add("D.F Kozarac 53 a");
      
       }
      
       public Data getData() {
       return pp;
       }
      
       public void setData(Data data) {
       this.data = data;
       }
      }
      


      The problem is that obviously, a4j:repeat doesn't work in this kinda way.
      The page which is rendered doesn't bring any data
      ??