6 Replies Latest reply on Oct 14, 2011 10:37 AM by Nghi Nguyen

    Problem with datascroller

    Nghi Nguyen Newbie

      I'm having a little issue and I am sure it is something trivial that someone can help me out. I have a search feature where I use a a4j:commandbutton to perform a search that will display results on the page. The results are in a rich:datatable to be span across a number of pages uses a rich:datascroller.

       

      I am using jsf2 along with richfaces 3.3.3. It is a session scoped bean where I stay on the same page and use the reRender option to update certain panels. The datatable renders fine but the datascroller is having issues. The data scroller will appear but no numbers appear nor are the buttons are working. Even if I refresh the datascroller never changes.I have tried to reRender the datascroller with no luck.

       

      Below is just a sample piece of code...

       

       

      <f:view>
          <h:form> 
              <rich:panel>    
                  <a4j:commandButton value="SEARCH" id="advancedSearchButton" actionListener="#{facetedSearchBean.deselect}" 
                     action="#{facetedSearchBean.performSearch}" reRender="searchResultsPanel" type="button" status="waitStatus"/>
                  <a4j:status id="waitStatus" forceId="true" onstart="javascript:Richfaces.showModalPanel('waitModalPanel');" 
                     onstop="javascript:Richfaces.hideModalPanel('waitModalPanel');"/>    
                  <rich:modalPanel id="waitModalPanel" autosized="true" width="25" height="25" moveable="false" resizeable="false" >
                      <h:graphicImage value="images/load.gif" style="width: 25px; height: 25x;" />                
                  </rich:modalPanel>
              </rich:panel>
       
              <rich:panel id="searchResultsPanel">
                  <rich:datascroller id="topDataScroller" for="searchResultsTable" ajaxSingle="false"/>       
                  <rich:dataTable id="searchResultsTable" border="0" rows="#{facetedSearchBean.numberOfResults}"
                      value="#{facetedSearchBean.searchHits}" var="hits">
                       <rich:column>
                       ...
                       </rich:column>                                 
                   </rich:dataTable>  
               </rich:panel>
           </f:form>
      </f:view>  
      
      

       

       

       

      Can anyone help me out?

        • 1. Re: Problem with datascroller
          Akaine Harga Novice

          I haven't tried to use RF3 with JSF2, but still I'd recommend 3 things:

          1. Put datascroller element inside datatable's header or footer facet, whatever you need (in this case no "for" attribute is needed btw).

          2. Set ajaxSingle to TRUE.

          3. Add reRender="searchResultsTable" to the datascroller.

           

          If the issue persists after that, blame RF3-JSF2 compatibility

          • 2. Re: Problem with datascroller
            Nghi Nguyen Newbie

            Thank you to the reply Akaine but that unfortunately did not fix the issue

            • 3. Re: Problem with datascroller
              Akaine Harga Novice

              Have you tried adding <a4j:keepAlive beanName="facetedSearchBean"> at the beginning of the the view?

               

              Also I'm not sure you should be using f:view without h:head and h:body if this page doesn't use template. RF uses JS to walk through the DOM, incorrect DOM structure can cause side effects. And in case you do use templates there's no need for f:view at all, just start adding tags after ui:define or whatever you have.

               

              Btw, you have </f:form> closing tag for the <h:form>.

              • 4. Re: Problem with datascroller
                Nghi Nguyen Newbie

                I added the keepAlive option before and it didn't seem to do anything.

                 

                Sorry, I do have the correct structure just didn't add it to the snippet of code and I mispelled the /f:form by accident when typing it onto the post.

                 

                I feel like I'm never going to get anywhere with this. Been driving me nuts for days. I have tried the data scroller example so I know it works but the only problem is I wasn't using a commandbutton.

                • 5. Re: Problem with datascroller
                  Akaine Harga Novice

                  What happens if you enclose datatable in a4j:region and rerender this one instead of the richpanel?

                  • 6. Re: Problem with datascroller
                    Nghi Nguyen Newbie

                    I quit on it after a while and finally figured it out. It was due to the rows="#{facetedSearchBean.numberOfResults}" on the datatable. I set this to the exact number of results I got back and the datascroller rendered it to one page. When I tried an exact number like 10, the data scroller worked and displayed only 10 results per page. Thanks again for all the suggestions!