2 Replies Latest reply on Jan 15, 2010 8:06 PM by 807575

    Dynamic tables and ListDataProvider

      Hello creator folk,

      I have to dynamicaly generate a table, whom data are not coming from a database but from a list of "Efficiency" objects. So I've read the formidable post by Winston Prakash, here: http://blogs.sun.com/winston/entry/creating_dynamic_table.

      Here are my Efficiency object, quite simple:
      public class Efficiency {
          private String abbr;
          private double eff;
          /** Creates a new instance of Efficiency */
          public Efficiency(String abbr, double eff) {
              this.abbr = abbr;
              this.eff = eff;
          public String getAbbr() {
              return abbr;
          public double getEff() {
              return eff;
      And here is the extract of prerender() where I compute the table:
                  ArrayList listEff = new ArrayList();
                  // skipping listEff generation. listEff is a list of Efficiency
                  // ...
                  // ...
                  listDataProvider = new ListDataProvider(listEff);
                  // I checked in the debugger, both listEff and listDataProvider got well filled
                  //Create the Table Dynamically
                  Table table = new Table();
                  table.setId("table_" + zoneName);
                  // Create the Table Row group dynamically
                  TableRowGroup rowGroup = new TableRowGroup();
                  rowGroup.setId("rowGroup_" + zoneName);
                  rowGroup.setValueBinding("sourceData", getApplication().
                  // Add the table row group to the table as a child
                  // Create the first table Column
                  TableColumn tableColumn1 = new TableColumn();
                  tableColumn1.setId("tableColumnAbbr_" + zoneName);
                  // Add the first table Column to the table row group
                  // Create the Static text and set its value as TRIPID
                  StaticText staticText1 = new StaticText();
                  staticText1.setValueBinding("text", getApplication().
                  // Add the static text to the table column1
                  // Create the second table Column
                  TableColumn tableColumn2 = new TableColumn();
                  tableColumn2.setId("tableColumnEff_" + zoneName);
                  // Add the second table Column to the table row group
                  // Create the Static text and set its value as DEPDATE
                  StaticText staticText2 = new StaticText();
                  staticText2.setValueBinding("text", getApplication().
                  // Add the Static Text2 to the table column2
      The result of the above code can be seen here: http://img151.imageshack.us/img151/9476/dynamictablebq9.png
      No data are found. As I said in the code comment, in the debugger I see that listDataProvider contains my data.

      My understanding is that my value binding expressions are not correct. Could you provide me a hint please?