13 Replies Latest reply on Mar 4, 2008 4:07 AM by Joern

    refresh/rerender whole datatable

    Joern Newbie

      Hi,

      i need to update a whole table, because i add columns dynamic. The datatable is bound to a backing bean:


      <rich:datatable id="detailsTable" binding="#{newEvent.detailsHtmlTable}">
       </rich:datatable>
      


      the getter of my bean:

      
      public HtmlDataTable getDetailsHtmlTable(){
      
       detailsHtmlTable = new HtmlDataTable();
       detailsHtmlTable.setId("detailsTable");
       detailsHtmlTable.setValueExpression("value",
       createValueExpression("#{newEvent.dateList}", ArrayList.class));
       detailsHtmlTable.setVar("record");
      
       HtmlColumn column = new HtmlColumn();
      
       HtmlOutputText dateText = new HtmlOutputText();
       dateText.setValueExpression("value",
       createValueExpression("#{record.eventDate}", Date.class));
       column.getChildren().add(dateText);
       detailsHtmlTable.getChildren().add(column);
      
       HtmlOutputText detailText;
       HtmlColumn detailColumn;
       for (int i = 0; i < DETAIL_SIZE; i++){
       detailText = new HtmlOutputText();
       detailText.setValueExpression("value",
       createValueExpression("#{record.eventDetailArray[" + i +"].detail}", String.class));
       detailColumn = new HtmlColumn();
       detailColumn.getChildren().add(detailText);
       detailsHtmlTable.getChildren().add(detailColumn);
       }
      
      


      my commandlink, that should refresh my table:

      <a4j:commandButton id="addDetailButton" value="add" image="/images/bt0_6.gif"
       action="#{newEvent.addDetail}" reRender="detailsTable"/>
      


      I could add some data to my datable and it is shown, but adding columns is not possible without reloading the whole htmlpage after hiting the commandlink. I also tried to put my datatable in a panelGroup, but its the same problem. any ideas?

      thanks a lot