2 Replies Latest reply on Mar 19, 2010 8:16 AM by Ilya Shaikovsky

    Resetting rich:datascroller to page 1 fails

    Steven De Groote Newbie

      Hi,

       

      I have a problem with my datascroller as I can't seem to put it back to page one programatically.

      My page is basically a list with some filter input fields. Paging works fine, so the user is on page 7 for instance.

      Then he changes filter values, submits to search again, but still appears to be on page 7.

       

      Here's what I do:

           public String submit() throws Exception {
                mdd.setPdfDisabled(false);
                mdd.setXmlDisabled(false);
                mdd.setCsvDisabled(false);
                
                // A regular submit should should the first page of results
                cmpResults.setFirst(0);
                cmpDataScroller.setPage(1);
                
                getLog().debug("Reset pager to first page");
                getLog().debug("Start of repeater: " + ((cmpResults == null) ? "null" : cmpResults.getFirst()));
                getLog().debug("Pager position: " + ((cmpDataScroller == null) ? "null" : cmpDataScroller.getPage()));
      
                mdd.loadItems(cmpResults.getFirst());
                return "";
           }
      

       

      In the logs, this strangely ends up like this:

      16:32:43,828 DEBUG be.sofico.web.mgbean.report.MasterDataDetailResults:105 - Reset pager to first page 16:32:44,203 DEBUG be.sofico.web.mgbean.report.MasterDataDetailResults:106 - Start of repeater: 0 16:32:44,562 DEBUG be.sofico.web.mgbean.report.MasterDataDetailResults:107 - Pager position: 7

       

      The cmpResults is btw a rich:dataRepeater, while the cmpDataScroller obviously the scroller that controls the repeater.


      Due to me setting setFirst(0), the user correctly gets the results from the first page after a submit, but the scroller still shows page 7 as the current page.

       

      Any ideas how I can reset this correctly?

       

      Thanks,

      Steven