12 Replies Latest reply on Apr 6, 2010 6:36 AM by nbelaevski

    Problem with Rich Data scroller

    manas123

      Hi Friends,

      I have encounter a problem with rich data scroller.

      The code:

      <rich:datascroller id="contentViewScroller" for="contentView" maxPages="#{categoryFormBean.noOfPage}" page="#{categoryFormBean.pageIndex}"/>

      <rich:dataTable id="contentView"
      value="#{categoryFormBean.displayList}"
      columnClasses="col1,col2,col3,col4,col5,col6,col7" var="item"
      rows="10" width="100%" >
      <rich:column>...

      Here i have used a rich data scroller for a rich data table with id contentView.

      when ever Rich data table is udpating with a new Data model, Rich Data scroller is not updating it's no of page. It's taking the no of of pages from the last Data model.

      But when ever i m clicking second time, it's showing correct no of pages.

      Can any one please help on this.

      Thanks in Advance.

      Manas

        • 1. Re: Problem with Rich Data scroller
          ilya_shaikovsky

          if you use ajax control to update the model - include datascroller id in reRender list.

          • 2. Re: Problem with Rich Data scroller
            dojolava

            I have the same problem,

            I use myfaces 1.2.4 and richfaces 3.2.1, also tried 1.2.3 with 3.2.0.

            Even if I reRender the datascroller it keeps showing the pages of the LAST data of the datatable.

            <a4j:commandLink value="..." reRender="resultListTable,resultListDatascroller" ... />

            <rich:datascroller id="resultListDatascroller" renderIfSinglePage="false" stepControls="hide" boundaryControls="show" fastControls="show" rendered="..." align="left" for="resultListTable" maxPages="10" page="..." />

            <rich:dataTable rowKeyVar="pos" id="resultListTable" frame="void" border="0" rows="..." value="..." var="result">
            <rich:column>
            ...
            </rich:column>
            </rich:dataTable>

            Can anyone help?

            • 3. Re: Problem with Rich Data scroller
              zaplitny

              We have two rich datatables with datascrollers and in one case it works fine, in other - the problem is reproduced. The reason between these tables is that in one case list instance is the same after update and in other (when wrong behavior) - new instance of list created each time. Have you any ideas, guys?

              • 4. Re: Problem with Rich Data scroller
                ilya_shaikovsky

                so just reset page binding in your action when you need to show new data in your dataTable.

                • 5. Re: Problem with Rich Data scroller
                  alefq

                  Hi, we have a similar problem, using RichFaces (3.3.0.GA) and Seam.
                  This is the case:

                   


                  <a4j:repeat  value="#{grupos}" rowKeyVar="row" var="grupoVar">
                      <a4j:outputPanel id="panelItems" >
                          <h:form>
                              <rich:dataTable  id="itemListId" value="#{itemsList}"
                                  var="itemVar"                    
                                  rows="5" rowKeyVar="rowItem">
                                 
                                  <f:facet name="footer">
                                      <rich:datascroller id="listScroller" for="itemListId"
                                          align="left" fastControls="hide"
                                          pagesVar="pages"
                                          page="#{actionUI.scrollerPage}"
                                          scrollerListener="#{actionUI.busquedaPaginada}"
                                          reRender="panelItems"
                                          eventsQueue="#{eventsQueue_param != null ? eventsQueue_param : 'default'}" >
                                          ...
                                          ...

                   

                   

                  The rows generated by a4j:repeat behaves like a toogle panel, when a button is clicked, one table is shown and the others are hidden.
                  If I go to the second page on any table, and after that I open another one wich only has one page,  the DataModel is updated
                  I have a new search to populate the rows to show, but the rowKeyVar from "itemListId" table, remains on the index set by the first
                  pagination made.

                   

                  actionUI.scrollerPage, shows the correct first page (index 0 for the new DataModel), but rowKeyVar does not, it keeps the value from the first pagination.

                   

                   

                  We did tests:

                  • without a4j:repeat, putting by hand the rows from "itemListId" table, and there we had no problem, each table  works fine, as we expect.
                  • replacing a4j:repeat with another rich:dataTable, and the problem persists
                  • rich:dataTable and a rich:subTable as children, no luck
                  • replacing a4j:repeat with ui:repeat (even though is not a real option, since we need the "rowKeyVar"), but it does not work either.

                   

                   

                  Anybody know a solution, what the  problem is, or any other alternative to have a variable list of tables in a sroollable way.

                   

                  Message was edited by: Ale Feltes

                  • 6. Re: Problem with Rich Data scroller
                    ilya_shaikovsky

                    Moving to RichFaces space as nto related to actual RichFaces development.

                    • 7. Re: Problem with Rich Data scroller
                      ilya_shaikovsky

                      At first please upgrade RF to latest 3.3.3 CR.

                       

                      I'm not sure that completelly understand the case. which rowKeyVar? repeat? table? And how does that affects the result?

                      actionUI.scrollerPage, shows the correct first page (index 0 for the new DataModel), but rowKeyVar does not, it keeps the value from the first pagination.

                      Some ready to run sample would be great.

                      • 8. Re: Problem with Rich Data scroller

                        I'm having the same problem with the dataScroller inside an a4j:repeat. When I click on the numbers in the dataScroller to change the page the datascroller stays on the first page and the dataTable keeps showing the data of the first page. When clicking on one of the number in the dataScroller, the datamodel is called but the range parameter provided to the walk() method of the dataModel contains the wrong firstRow (always 0).

                         

                        I'm using the a4j:repeat tag to iterate over a list of dataModels for which a dataTable and dataScroller will be created.This because I have a dynamic number of dataTables which I need to show.

                         

                        <a4j:repeat value="#{myBackingBean.dataModelList}" var="dataModel">

                             <rich:dataTable id="myTable" value="#{dataModel}" var="mainVar"
                                  rows="#{dataModel.amountOfRows}" first="#{dataModel.first}">

                                  // columns of the table ....

                             </rich:dataTable>

                         

                             <rich:datascroller id="myDataScroller"
                                  for="myTable"
                                  maxPages="7"
                                  renderIfSinglePage="false" ajaxSingle="false"
                                  page="#{dataModel.currentPage}"
                                  scrollerListener="#{dataModel.scrollerListener}" />

                        </a4j:repeat>

                         

                        <t:saveState value="#{myBackingBean.dataModelList}"/>

                         

                        We use a custom dataModel which extends from SerializableDataModel, in which we enable real database pagination of data.

                         

                        But when I try the following(makes no sense really, but was just to see whether pagination would work this way), the pagination is working correctly:

                         

                        <a4j:repeat value="#{myBackingBean.dataModelList}"  var="dataModel">

                             <rich:dataTable id="myTable" value="#{myBackingBean.dataModelList[0]}"  var="mainVar"
                                   rows="#{myBackingBean.dataModelList[0].amountOfRows}"  first="#{myBackingBean.dataModelList[0].first}">

                                  // columns of the table ....

                             </rich:dataTable>

                         

                             <rich:datascroller id="myDataScroller"
                                   for="myTable"
                                   maxPages="7"
                                   renderIfSinglePage="false" ajaxSingle="false"
                                   page="#{myBackingBean.dataModelList[0].currentPage}"
                                   scrollerListener="#{myBackingBean.dataModelList[0].scrollerListener}" />

                        </a4j:repeat>

                         

                        In this example I directly reference the first datamodel in the list and it works. The first example also doesn't work when there's only one dataModel in the list.

                        • 9. Re: Problem with Rich Data scroller

                          Before making the post above, I upgraded RF to 3.3.3.CR1, but I'm still having the same problem.

                          • 10. Re: Problem with Rich Data scroller
                            alefq

                            Hi Ilya, before anything, thank you for your will to help.

                             

                            Upgrading is not our first choice have right now (we have plans to the upgrade, but not at the moment), since we already have several pages in production without major problems, and only a small percentage with this particular problem.

                             

                            In case you have the time, here are some code (I hope ready to run )  wich produces the problem.

                             

                            Is very similar to Yennick's case, but we use the scroller insede the facet:footer.

                             

                            Steps to reproduce:

                             


                            - Click on "Init Data" button. (this populates the lists)

                             

                            - Click on first "Show" button and go to page 2.

                             

                            - Click on second "Show button" and there's no row showed.

                             


                            Thanks in advance

                             


                            Ale

                            • 11. Re: Problem with Rich Data scroller

                              I found a solution for the problem. While searching for a solution I stumbled upon this article about a4j:repeat and tabs, menuItems etc. http://community.jboss.org/wiki/Cantusea4jrepeattoiteratethemenuItemstabsetc

                              So I tried to use the c:forEach instead of the a4j:repeat and now it works. Don't know whether the explanation given in the article is also valid for this problem, but it works.

                              • 12. Re: Problem with Rich Data scroller
                                nbelaevski

                                Hi,

                                 

                                rich:datascroller for nested iteration components (e.g. rich:dataTable inside a4j:repeat) is not supported currently. There's JIRA issue for this problem.