2 Replies Latest reply on Mar 11, 2008 6:37 AM by Steffen Grimm

    rich:scrollableDataTable shows up, then disappears, help nee

    Steffen Grimm Newbie

      Hi,

      I use a rich:scrollableDataTable with a binding to dynamically create the columns:

      <rich:scrollableDataTable id="myTable"
       binding="#{dynamicTableBean.dataTable}"
       value="#{dynamicTableBean.items}" var="item" width="700"
       height="400" rows="40" sortMode="single" />
      
      <a4j:commandLink value="Update" reRender="myTable"
       action="#{dynamicTableBean.rerenderTable}" />
      


      public void rerenderTable() {
       HtmlColumn col;
       HtmlOutputText col_header;
       HtmlOutputText col_content;
      
       // Remove old columns
       List<Object> list = dataTable.getChildren();
       if (!list.isEmpty()) {
       int size = list.size();
       for (int i = 0; i < size; i++) {
       list.remove(0);
       }
       }
      
       for (String column : selectedColumns) {
       // header
       col_header = new HtmlOutputText();
       col_header.setValue(column);
      
       // content
       col_content = new HtmlOutputText();
       col_content.setValueBinding("value", createValueBinding("#{item."
       + column + "}"));
      
       // column
       col = new HtmlColumn();
       col.getFacets().put("header", col_header);
       col.getChildren().add(col_content);
       col.setId(column);
      
       dataTable.getChildren().add(col);
       }
       }
      


      When I invoke the rerender method, table is correctly displayed for 2 seconds and then disappears. During this 2 seconds CPU is at 100% and I can't do anything. This code perfectly worked with a regular rich:datatable.

      Does anyone knows a solution on this?

      Thanks and cheers