6 Replies Latest reply on Apr 17, 2007 2:47 AM by sergeysmirnov

    Reset datascroller

    furic

      Hello
      How do i reset datascroller when i filter DB data by new criteria ?
      I have few input fileds for criteria with "Find" button on page, dataTable with datascroller.

      <a4j:commandButton type="submit" value="Find" reRender="clientsTable" id="findBtn" actionListener="#{clientsBean.resetDataScroller}"/>
      
      <rich:dataTable value="#{clientsBean.tableModel}" var="client" binding="#{clientsBean.table}" id="clientsTable" rows="16" >
      </rich:dataTable>
      

      resetDataScroller looks like this :
      public void resetDataScroller(ActionEvent event){
       table.setFirst(0);
      }


      What happens is , that if first "Find" returns 2 pages, and second "Find" returns 10 pages, i can't scroll to 3-rd page.
      Also, when i press "Find" second time, current page remains unchanged (i expect to see first page).
      Thanks

        • 1. Re: Reset datascroller

          you have to reset not only the table, but the datascroller as well. I.e. add id of datascroller to reRender

          • 2. Re: Reset datascroller
            furic

            I've tried to rerender also datascroller with no success:

            <a4j:commandButton type="submit" value="Find" reRender="clientsTable,paginator"
            status="ajaxStatus" id="findBtn" actionListener="#{clientsBean.resetDataScroller}"/>
            
            <rich:dataTable value="#{clientsBean.tableModel}" var="client" binding="#{clientsBean.table}"
             id="clientsTable" rows="16" rendered="#{not empty clientsBean.tableModel}">
            
            <f:facet name="footer">
            <rich:datascroller id="paginator" maxPages="10" status="ajaxStatus"
             renderIfSinglePage="true" ajaxSingle="false" >
             <f:facet name="first">
            <t:graphicImage url='#{requestScope["basePath"]}img/buttons/first.gif' alt="First"/>
             </f:facet>
             <f:facet name="next">
             <t:graphicImage url='#{requestScope["basePath"]}img/buttons/next.gif' alt="Next"/>
             </f:facet>
             <f:facet name="previous">
             <t:graphicImage url='#{requestScope["basePath"]}img/buttons/prev.gif' alt="Previous"/>
             </f:facet>
             <f:facet name="last">
             <t:graphicImage url='#{requestScope["basePath"]}img/buttons/last.gif' alt="Last"/>
             </f:facet>
             </rich:datascroller>
             </f:facet>
            </rich:dataTable>
            



            • 3. Re: Reset datascroller

              Ok, I did not realize you have a datascroller inside the table. In this case, you do not need to point to the datascroller explicitly

              • 4. Re: Reset datascroller
                furic

                Ok, but what can be the solution ?
                What am i doing wrong ?
                Thanks

                • 5. Re: Reset datascroller
                  furic

                  Does anyone have working example updating dataTable with scroller from ajax request ?
                  RichFaces team, should i open the issue if solution can't be found ?
                  I can create mock-up application that reproduces the issue
                  Thanks

                  • 6. Re: Reset datascroller

                    yes. open the new issue and attach the your mockup there.