2 Replies Latest reply on Mar 28, 2011 5:19 AM by benma

    rich:datascroller binding HtmlDatascroller.getPage() problem

    benma

      Hello.

      I have jsf 1.2 and richfaces 3.3.3.Final.

      I have a binding of rich:datascroller in my java.

      A weird thing happens though: getPage() method sometimes returns the right page numbers and sometimes the wrong ones.

      What's wrong with that?

       

      The component in jsf:

       

          <rich:datascroller id="tableScroller" renderIfSinglePage="false" for="projectPlanCreatetable" pageIndexVar="pageNo"

                   binding="#{ProjectPlanCreateControl.listAction.scroller}" >

                   <a4j:support event="onpagechange" action="#{ProjectPlanCreateControl.pageChanged}" reRender="visitedPages"

                           oncomplete="markPages();"/>

          </rich:datascroller>

       

          <h:inputHidden id="visitedPages" value="#{ProjectPlanCreateControl.visited}" />

       

      and the javascript:

       

      function markPages(){

                var pages = document.getElementById('mainFrm:projectPlanCreatetable:visitedPages').value;

                pagesArr = pages.split(",");

       

                for (var i=0; i<pagesArr.length-1; i++){

            jQuery('td.rich-datascr-inact').filter(function() {

            return jQuery(this).text() == pagesArr[i];

                          }).css('color','red');

                }

      }

       

       

      The java:

       

      public String pageChanged(){

           HtmlDatascroller scroller = listAction.getScroller();           

           visited += scroller.getPage() + ",";

           return "";

      }