2 Replies Latest reply on Jan 20, 2011 10:13 AM by Romeo Zdrite

    rich:Datascroller doesn't change the displayed content of my datatable

    Romeo Zdrite Newbie

      Hey,

       

      I've been working with rich:dataScroller and rich: dataTable before on small projects, but now they seem to not work together.

      When I click on the datascroller, it changes the page number, but it won't refresh the datatable.

      The bean that manages the array to be displayed on the datatable is session scoped, so I've noticed that when rerunning the application the datatable displays only the last page selected from the datascroller. Seeing this, a partial solution with which I came up to is to set the "action" atribute of the datascroller to refresh the page in which the 2 components are displayed. This solution is kinda slow, and sometimes fails because the browser displays only text results, i.e. it omits the richfaces graphics.

       

      The getter on the array that the datascroller displays is a general getter, and the array is populated in another method that is triggered when navigating to this page. I tried populating the array in the getter, like I've seen in most of the tutorials on datascrollers, but the result is still the same.

       

      To conclude, is there a solution to refresh the dataTable without refreshing the whole page when selecting a different page from the datascroller?

       

      Thank you in advance.

        • 2. Re: rich:Datascroller doesn't change the displayed content of my datatable
          Romeo Zdrite Newbie

          Hey,

           

          I'm using richfaces 3.3.0. I've used the same version a few months ago when doing some university related projects, without this problem.

          This time I'm also using JQuery but I've set it so it won't intefere with richfaces (renaming the $ variable) and other components seem to work as they should now.

           

          The datascroller and datatable header are placed inside a form tag and they look like this

           

          <rich:datascroller action="afisare" id="sc1" reRender="sc2" for="table" maxPages="10" page="#{menuBean.pagina}" > </rich:datascroller>

                                      <rich:dataTable id="table" value="#{menuBean.lista}"                                           

                                                      var="anunt" rows="10"

                                                      rowKeyVar="rowKey"                                           

                                                      columnClasses="photoColumn,textColumn,priceColumn,dateColumn">

           

          At the end of the datatable I have a similar datascroller, synchronized with the first one:

           

          <rich:datascroller action="afisare" id="sc2" reRender="sc1" for="table" maxPages="10" page="#{menuBean.pagina}"></rich:datascroller>

           

          The action="afisare" parameter makes the page refresh when clicking the datascroller and this is the parameter I want to skip. i.e. refresh the table without refreshing the page.

          The datatable contains some controller that trigger some javascripts and open a modalpanel, if this code might interfere with the refresh of the datatable please tell me and I will paste it here.

           

          The getter of the array to be displayed is straight forward, as follows:

           

          public ArrayList<Anunt> getLista() {

                  return lista;

              }

           

          I am populating the array in a different method when the navigation to the displaying page is triggered, in the following method:

           

          public void populeazaLista(ArrayList<SearchCriteria> crit) {

           

                  lista.clear();

                  AfisareService as = new AfisareService();

                  lista = as.returneaza(crit);

           

              }

          In the method above lista is populated from a database. It contains enough entries to fill 4 pages of the table, 10 rows each.

          The bean that holds the navigation logic, the array to be displayed and the populating method is session scoped. The last lines of the method that navigates to the table page are the following:

           

              populeazaLista(crit);

                  return "afisare"; //afisare.jpg is the jsf page that displays the datatable

           

          If I missed any relevant code, please tell me, and thanks in advance.

          Also from time to time it doesn't display the richfaces components, on refresh (but only when I force the refresh from the datascroller), but just plain text. The application is deployed on glassfish 3, but don't know if the server is the problem or something in my application.