1 Reply Latest reply on Jun 3, 2011 11:00 AM by nimoh

    problem getting current page from datascroller

    nimoh

      I am using rich:extendedDataTable with rich:datascroller and I am having the following problem.

       

      My datascroller code looks like this:

       

      <rich:datascroller id="bottomScroller"  align="center" for="SubjectTable" styleClass="paginator"

           binding="#{participationStatusHandler.scroller}"/>

       

      the scroller reference is to a UIDataScroller object.  Everything seems to be working except for the following:

       

      When the user clicks a button and invokes a method in my backing bean, I am trying to get the currently selected page.  When I call scroller.getPage() it always returns 1 (even if I am on page 2 and the GUI is showing page 2).

       

      If I change the datascroller defintition to use page attribute instead of binding I can get the currently selected page number, but other things break such as when the user tries to filter the table from any page other than 1.

       

      any help is appreciated

        • 1. Re: problem getting current page from datascroller
          nimoh

          I have a workaround for this issue.  I changed the datascroller to use the page attribute, and added the following method to do filtering:

           

          In my name column, the filter facet is as follows (filterMethod defined in column definition):

          <f:facet name="filter">
              <h:inputText value="#{participationStatusHandler.currentNameFilterValue}"
                   id="nameFilterInput" style="width:90%" onkeyup="executeNameFilter(this.value);">
              </h:inputText>
          </f:facet>

           

          Function invoked by onkeyup event in filter facet:

          <a4j:jsFunction id="executeNameFilter" name="executeNameFilter" requestDelay="700"
                  ignoreDupResponses="true" oncomplete="reRenderTable('nameFilterInput');">
              <a4j:actionparam name="pageNumber" value="1" assignTo="#{participationStatusHandler.scrollerPage}"/>
          </a4j:jsFunction>

           

          This seems to do the trick, but I don't believe it should be necessary, I would appreciate any insight into why binding to a UIDatascroller always has a value of 1 for page.