4 Replies Latest reply on Jan 23, 2009 10:58 AM by Ilya Shaikovsky

    datascroller issue

    Wolfgang Bergbauer Newbie

      Hi all,

      I am trying to get the datascroller working on my webpage.
      The page shows 3 search fields and the list of items below.
      You can scroll with the datascroller.

      The goal is that the datascroller is reset whenever you submit a new query.

      First Issue
      Use the page attribute in the datascroller to scroll to a predefined page messes up the datascroller:

      <rich:datascroller id="pageinator" maxPages="100" for="customMckKbSearchList" selectedStyle="font-weight:bold"
      pageIndexVar="currentPage" page="#{displayPage}" pagesVar="totalPages" renderIfSinglePage="false" >


      so the #{displayPage} is the request scope variable.
      Entering a link with ?displayPage=2 will work and the table is on page 2. But now the scroller does not work any more:
      Click on next page and it scrolles to page 3.
      Click on next page and it stays at 3.
      Click back and it goes from 3 to one.
      Click on next page and it jumps t 3.

      Second issue:
      Doing a lookup on the backing bean and trying to change the behavior of the datascroller/table does not work at all.
      Nothing happens, I execute this initDataScroller with a command button on the page. I see the log, but it does not change anything.

      @In("#{uiComponent[':tableresults:customMckKbSearchList:pageinator']}")
       protected HtmlDatascroller tableHTML;
      
      
       public void initDataScroller() {
       log.info("Setting table to 1");
       tableHTML.setPage(1);
       }


      I use the latest stable richfaces and seam versions.
      Thanks all for your help.

      Wolfgang



        • 1. Re: datascroller issue
          Wolfgang Bergbauer Newbie

          I solved most part of the issue.
          The problem was that the backing bean was not in the conversation scope.

          Still there is one strange behavior:

          Lets say I am on page 3 of the list, and then I enter something new in my search field.
          The ajax call is calling initDataScroller() and the List page is on page one. Great so far.

          But when I click on the Next Page icon of the datascroller, nothing happens. Only on the seond click I will get the second page.
          When I check the datascrollers page attribute value binding (page="#{displayPage}") I see:
          - on the first click, only the setter is called
          - on the second click the setter and then the getter is called

          Could this a jsf lifecycle problem which I do not get? Why is only the getter called on the first click?

          Kind regards,

          Wolfgang

          • 2. Re: datascroller issue
            Nick Belaevski Master

            Hi Wolfgang,

            "freakwave" wrote:
            - on the first click, only the setter is called
            - on the second click the setter and then the getter is called

            Could this a jsf lifecycle problem which I do not get? Why is only the getter called on the first click?
            Can you please clarify what is called on the first click: getter, setter or both?

            • 3. Re: datascroller issue
              Wolfgang Bergbauer Newbie

              Hi nbelaevski,

              It is only the setter that is called on the first click.
              On the second click it is the normal cycle, first setter and then the getter.

              Kind regards,

              Wolfgang

              • 4. Re: datascroller issue
                Ilya Shaikovsky Master

                 

                <h:form>
                 <rich:datascroller align="left" for="carList" maxPages="20"
                 page="#{dataTableScrollerBean.scrollerPage}" reRender="sc2" id="sc1" />
                 <rich:spacer height="30" />
                 <rich:dataTable width="483" id="carList" rows="10" columnClasses="col"
                 value="#{dataTableScrollerBean.allCars}" var="category">
                 <f:facet name="header">
                 <rich:columnGroup>
                 <h:column>
                 <h:outputText styleClass="headerText" value="Make" />
                 </h:column>
                 <h:column>
                 <h:outputText styleClass="headerText" value="Model" />
                 </h:column>
                 <h:column>
                 <h:outputText styleClass="headerText" value="Price" />
                 </h:column>
                 <h:column>
                 <h:outputText styleClass="headerText" value="Mileage" />
                 </h:column>
                 </rich:columnGroup>
                 </f:facet>
                
                 <h:column>
                 <h:outputText value="#{category.make}" />
                 </h:column>
                 <h:column>
                 <h:outputText value="#{category.model}" />
                 </h:column>
                 <h:column>
                 <h:outputText value="#{category.price}" />
                 </h:column>
                 <h:column>
                 <h:outputText value="#{category.mileage}" />
                 </h:column>
                
                
                
                 </rich:dataTable>
                 <rich:datascroller align="left" for="carList" maxPages="20"
                 page="#{dataTableScrollerBean.scrollerPage}" id="sc2" reRender="sc1" />
                 <a4j:commandLink value="reset" ajaxSingle="true" reRender="sc1,sc2">
                 <a4j:actionparam value="1" name="page" assignTo="#{dataTableScrollerBean.scrollerPage}"></a4j:actionparam>
                 </a4j:commandLink>
                 <a4j:commandLink value="reset2" ajaxSingle="false" reRender="sc1,sc2">
                 <a4j:actionparam value="1" name="page" assignTo="#{dataTableScrollerBean.scrollerPage}"></a4j:actionparam>
                 </a4j:commandLink>
                 </h:form>


                It works fine for me with both links.. :( Maybe you able to share your sample?