2 Replies Latest reply on Oct 4, 2007 11:36 AM by Florian Duehring

    Problem with dataScroller, dataTable & DataModel

    Florian Duehring Newbie

      According to this post http://www.jboss.com/index.html?module=bb&op=viewtopic&t=112564&postdays=0&postorder=asc&start=10 I tried to implement pagination for my dataScroller:

      ...
      <rich:dataTable
       binding="#{mse.mseItemTable}"
       rows="#{mse.numberOfVisibleRows}"
       id="mse_mseItems"
       value="#{mse.mseItems}"
       var="item"
      >
      ....
      </rich:dataTable>
      <rich:datascroller
       ajaxSingle="false"
       binding="#{mse.dataScroller}"
       id="mse_dsMseItems"
       for="mse_mseItems"
      />
      ...
      

      Heres the relevant part of my backing bean:

      public final DataModel getMseItems() {
       ArrayList<Element> elements = this.getElements();
       Integer fromItem = this.mseItemTable.getFirst();
       Integer toItem = null;
       // check if first row plus number of visible rows is
       // smaller then availiable data sets
       if (this.mseItemTable.getFirst() + this.numberOfVisibleRows <
       mseItemsOfCurrentGeschaeftsstelle.size()) {
       toItem = this.mseItemTable.getFirst()
       + this.numberOfVisibleRows;
       } else{
       toItem = mseItemsOfCurrentGeschaeftsstelle.size();
       }
       PagedListDataModel dataModel =
       new PagedListDataModel(
       this.getElements.subList(fromItem, toItem),
       this.getElements.size(),
       this.numberOfVisibleRows
       );
       return dataModel;
      }
      

      This worked fine with version 3.0.1.
      With the 3.1.0-version I have the problem that I can scroll only to page 2.
      If I click to the next page, nothing happens.
      I made a System.out.println(fromItem, toItem) with the following result (clicking on next page-Control of the dataScroller):

      init:
      0 to 10
      0 to 10

      first click:
      0 to 10
      10 to 20

      second click:
      0 to 10
      10 to 20

      third click:
      0 to 10
      10 to 20

      fourth click:
      0 to 10
      10 to 20

      fifth click:
      10 to 20
      20 to 30

      sixth click:
      10 to 20
      20 to 30

      seventh click:
      0 to 10
      10 to 20


      As you can see, the fifth click works, but when I click some more times, it jumps back.
      Does anybody has an idea why this strange behaviour occurs???