2 Replies Latest reply on Feb 1, 2008 9:41 PM by neilac333

    Getting Next Page From <rich:datascroller>

    neilac333 Novice

      Quick question:

      When the user scrolls to a page by clicking on a number in <rich:datascroller>, how can I get the desired page number to a MethodBinding expression?

      Currently, I am doing the following:

      <rich:datascroller for="searchResults"
       maxPages="100"
       rendered="#{not empty myAction.searchResults}"
       pageIndexVar="pageIndex"
       scrollerListener="#{myAction.setCurrentPage(pageIndex)}">
      </rich:datascroller>
      


      Note I am using the Seam extended EL here.

      Unfortunately, this just passes the current page rather than the desired scrolled-to page to the myAction component. As a result, the scroller just stays on the same page.

      Any insight on how to get the desired page to my component is very much appreciated.

      Thanks.

        • 1. Re: Getting Next Page From <rich:datascroller>
          Ilya Shaikovsky Master

          It isn't nessesary to pass the value from the client if you use listener.. check my simple code.. I think its usable in your case:

          <rich:datascroller scrollerListener="#{bean.actionListener}"/>


          public void actionListener(DataScrollerEvent event) {
           System.out.println(event.getNewScrolVal());
           System.out.println(event.getOldScrolVal());
           }
          


          • 2. Re: Getting Next Page From <rich:datascroller>
            neilac333 Novice

            Thanks, Ilya. That is just what I needed.

            It is interesting though that the DataScrollerEvent contains the page number if the user chooses a number or the type of button that was pressed. This is certainly not surprising, but there seem to be more constants than there are buttons. Is there some plan to add more buttons to the scroller in the future?

            Thanks again.