1 Reply Latest reply on Aug 4, 2010 5:28 AM by mvg kumar

    Unable to update Page wise column total in JSF datatable when using Richfaces datascroller

    mvg kumar Newbie

      I am creating a datatable which shows the footer with the total of columns

       

      My JSF code is

       

      <h:dataTable id="summary" binding="#{outboundCall.summaryTable}">
                                              
                                          </h:dataTable>
                                          <rich:datascroller reRender="summary" for="summary" style="width:623px;font-family : Verdana;font-weight: bold;">
                                              <a4j:support event="onpagechange"/> 
                                          </rich:datascroller>

       

      My java code is

       

      public HtmlDataTable getSummaryTable() 
          {
              summaryTable = new HtmlDataTable();
              summaryTable.setRowClasses("datatablecontent");
              summaryTable.setColumnClasses("datatablecontent");
              summaryTable.setHeaderClass("datatableheader");
              summaryTable.setFooterClass("datatablecontent");
              summaryTable.setVar("data");
              summaryTable.setRows(5);
              //summaryTable.setId("summaryTable");
              summaryTable.setValueExpression("value", createValueExpression("#{outboundCall.summaryReports}", List.class));
              summaryTable.setRendered(getDataTableRendered());
                              
              HtmlColumn column1 = getColumnDetails("Dialled Date", "#{data.dialledDate}");
              HtmlOutputText footerText1 = new HtmlOutputText();
              footerText1.setValue("Total");        
              column1.setFooter(footerText1);
              summaryTable.getChildren().add(column1);
              
              if(getStatus().equalsIgnoreCase("success") || getStatus().equalsIgnoreCase("all"))
              {
                  System.out.println("Before footer calculation");
                  int subTotalPrice = 0;
                  for (int i = summaryTable.getFirst(); 
                           i < summaryTable.getFirst() + summaryTable.getRows() && 
                           i < getSummaryReports().size(); i++) 
                  {
                      SummaryReportsForOutBoundCalls dataItem = getSummaryReports().get(i);
                      String dataItemPrice = dataItem.getSuccessCount();
                      subTotalPrice += Integer.parseInt(dataItemPrice);
                      dataItem.setTotalCallsTotal(Integer.toString(subTotalPrice));
                  }
                  
                  setFooterTotalToDisplay(Integer.toString(subTotalPrice));
                  HtmlColumn column2 = getColumnDetails("Success", "#{data.successCount}");
                  HtmlOutputText footerText2 = new HtmlOutputText();
                  footerText2.setValue(subTotalPrice);
                  column2.setFooter(footerText2);
                  
                  summaryTable.getChildren().add(column2);            
              }
              
              return summaryTable;
          }

       

      I followed this discussion to create page wise total

       

      How to get the page wise total updated for every page when I scroll datatable using richfaces datascroller?

       

      If it is not possible in Richfaces datascroller, Can you suggest me the alternative solution?

       

      Please help?

       

      Thanks in advance

       

      Please update me if my question is not clear

       

      Message was edited by: Girish Mony