1 Reply Latest reply on Feb 8, 2008 5:01 AM by Peter Lustig

    Datascroller problem

    Peter Lustig Newbie

      Hello all,

      i have a problem synchronizing multiple datascroller instances with each other. The problem is, they are all referring to the same dataTable instance,
      which resides inside multiple tabs.

      So in tab one i show properties 1-5, on tab 2 properties 6-10 from the same result column.

      Now let's say i have rows 10-20 showing on tab 1, if i select tab 2 i want to see rows 10-20 too, instead of rows 1-10. I somewhat could accomplish this using a component binding and synchronizing these with each other. Maybe there is some more elegant way to do this. If so i'd be glad if someone would point me to a code example.

      Now i have the following problem, if i have 300 result pages from a query. Now i select the last page from the query. In the next step i refine my query to narrow down my results. But what happens is that the datascroller instance is set on the page it was BEFORE the update to my model happened, so actually NO page is selected.

      How can i update the datascroller to have it set on the first page after the query executes?

      Here is a code snippet, which perhaps can help make this more clear:

      <rich:tabPanel switchType="ajax" >
       <rich:tab label="Tab1">
       <rich:dataTable id="statsClients" rows="10" value="#{allClients}" var="client">
       <rich:datascroller scrollerListener="#{sState.scrolled}" renderIfSinglePage="false" align="left" action="#{sState.sync('tab1')}" binding="#{sState.hds_base}" fastStep="5" for="statsClients" maxPages="22" />
       <rich:tab label="Tab2">
       <rich:dataTable id="statsClients_a" rows="10" value="#{allClients}" var="client">
       <rich:datascroller renderIfSinglePage="false" align="left" action="#{sState.sync('tab2')}" binding="#{sState.hds_waas}" fastStep="5" for="statsClients_a" maxPages="22" />
       <rich:tab label="Tab3">
       <rich:dataTable id="statsClients_b" rows="10" value="#{allClients}" var="client">
       <rich:datascroller renderIfSinglePage="false" action="#{sState.sync('tab3')}" binding="#{sState.hds_b}" align="left" fastStep="5" for="statsClients_b" maxPages="22" />

      I am using Richfaces-3.1.3 btw.


        • 1. Re: Datascroller problem
          Peter Lustig Newbie

          For anyone maybe interrested or having the same problem ... You can use the scrollerListener to synchronize the pages, simply do:

          public void scrolled(DataScrollerEvent event) {
           String newVal = event.getNewScrolVal();

          Since i am using seam, i am raising an event when my query executed,
          you then do:

           public void syncScrollers() {

          To set all scrollers to the first page.