12 Replies Latest reply on Mar 26, 2010 9:47 AM by bb bb

    Datascroller rerenders data table on each ajax request

    Anton Lisovenko Newbie


      I have a simple dataScroller with no a4j:outputPanel:

      <rich:datascroller align="right" page="#{paymentFilterBean.pageNumber}" for="paymentTable"
       maxPages="10" reRender="sc1" id="sc2" />

      and a table:
      <rich:dataTable var="selectedPayment" value="#{paymentBean.entities}" id="paymentTable"
       width="100%" rows="16" >

      There is also a link on the page:
       <a4j:commandLink limitToList="true" ajaxSingle="true" id="expenseItem" reRender="expenses_panel" oncomplete="#{rich:component('expenses_panel')}.show()">
       <h:outputText value="#{paymentFilterBean.filterExpense.displayName}" />

      The problem
      : each time I click the link, the table is rerendered and all data is fetched again. During debuging I found some kind of stack trace during the rerendering phase:

      HtmlDataTable(UIDataTable).createDataModel() line: 120
      HtmlDataTable(UIDataAdaptor).getExtendedDataModel() line: 621
      HtmlDataTable(UIDataAdaptor).getRowCount() line: 248
      HtmlDatascroller(UIDatascroller).getRowCount(UIData) line: 362
      HtmlDatascroller(UIDatascroller).setupFirstRowValue() line: 452
      RenderPhaseDataScrollerVisitor.afterRoot(PhaseEvent, Object) line: 191
      RenderPhaseComponentListener.beforePhase(PhaseEvent) line: 73
      AjaxViewRoot.processPhaseListeners(FacesContext, PhaseId, boolean) line: 185

      Also, found that this is a new behavior for RF since 3.2.1 and datascroller refreshes data even when neither it, nor the table is rerendered. It's really confusing.... How can I avoid excess datatable rerenderings and fetching data from database on each ajax calls? The worst thing is when I open the modalpanel with rich:tree. The table is rerendered on every node selection in the tree in the modal panel!!!