1 Reply Latest reply on May 24, 2010 2:22 AM by Ilya Shaikovsky

    Dynamically populating ExtendedDataTable

    Kesav Rayaprolu Newbie

      Hi,

       

      We are evaluating Richfaces to replace our old UI using old technology. I am currently evaluating Richfaces v3.3.3.Final

       

      As part of it, I am trying to populate Extended Data Table from a backing bean in Java. After a long struggle, I am able to display the Extended Data table, but the data would not show up. If I directly define in the Extended Data Table in XHTML, the data is displayed, can anyone please help me.

       

      Java Code:

       

      public HtmlExtendedDataTable getPreviewTable(List data, List columnNames) {
              HtmlExtendedDataTable previewTable = new HtmlExtendedDataTable();
              ArrayList previewData = transposeData(data);

       

              int cntr = 0;
              Iterator itr = previewData.iterator();
              while (itr.hasNext()) {
                  List columnData = (List) itr.next();
                  String columnName = columnNames.get(cntr++).toString();
                  HtmlColumn column = new HtmlColumn();

       

                  column.setLabel(columnName);
                  column.setSortable(true);
                  column.setSortBy(columnName);
                  column.setId(columnName);
                 
                  HtmlOutputText header = new HtmlOutputText();
                  header.setValue(columnName);
                  header.setStyle("text-align:center; font-size:12px; font-weight:bold");
                 
                  column.setHeader(header);
                 
                  HtmlOutputText colData = new HtmlOutputText();
                  colData.setValue(columnData);

       

                  column.getChildren().add(colData);
                  previewTable.getChildren().add(column);
                 
              }

       

              return previewTable;
          }

       

      XHTML code:

      <rich:extendedDataTable binding="#{newUI.previewData}"
                                          var="item"
                                          height="275px"
                                          width="740px"
                                          id="populateTable" />

       

      I am using Glassfish v2.1.1 and spring webflow.

       

      Thanks in advance.