5 Replies Latest reply on Mar 16, 2012 2:32 AM by Sabyasachi Rout

    rich:dataScroller doesn't work (Richfaces 4.2.0)

    Akaine Harga Novice



      Recently I've started playing seriously with RF4 (had been working with RF3 for almost 3 years before that) and have some serious problems with some basic functionality. One is:


      rich:dataScroller doesn't work.

      Scenario 1. If I click any of its buttons nothing happens.

      Scenario 2. I click a page button and then "first page" button or any "arrow" button the datatable empties itself.


      I've made a brief search through the forums and didn't find any helpful info so I'm really stuck here...


      Here's the code from a demo app I'm working on (so no fancy things here, just the datatable fed with a list):

      <h:form id="form_cars">
                <rich:dataTable id="dt_cars" value="#{managedBean1.cars}" var="car" rowKeyVar="row" rows="10">
                                    <f:facet name="header">Brand</f:facet>
                                    <h:outputText value="#{car.brand}"/>
                          <rich:column style="text-align: right;">
                                    <f:facet name="header">Model</f:facet>
                                    <h:outputText value="#{car.model}"/>
                          <rich:column style="text-align: right;">
                                    <f:facet name="header">Price</f:facet>
                                    <h:outputText value="#{car.price}">
                                         <f:convertNumber pattern="$#,###.00" type="currency" locale="es_MX"/>
                          <rich:column style="text-align: center;">
                                    <f:facet name="header">Sold</f:facet>
                                    <h:outputText value="#{car.sold?'Y':'N'}"/>
                          <f:facet name="footer">
                                    <rich:dataScroller id="ds_cars" for="dt_cars" page="#{managedBean1.page}"/>


      Forgot to mention: I'm running the thing under JBoss 7.1

      Libs list (all exported with the WAR):

      - javax.faces-2.1.7

      - cssparser-0.9.5 (tried with cssparser-0.9.6.jar)

      - guava-10.0.1 (tried with guava-11.0.2.jar)

      - sac-1.3

      - richfaces-components-api-4.2.0.Final

      - richfaces-components-ui-4.2.0.Final

      - richfaces-core-api-4.2.0.Final

      - richfaces-core-impl-4.2.0.Final

        • 1. Re: rich:dataScroller doesn't work (Richfaces 4.2.0)
          Brendan Healey Master

          I've got a approx 30 pages using dataScroller, and they're all working 100% to specification after a rigorous system test

          with 4.2.0.Final, so you must be doing something I'm not doing. In the footer I use:




          ... and nothing else

          • 2. Re: rich:dataScroller doesn't work (Richfaces 4.2.0)
            Akaine Harga Novice

            Still having the same problem. Here are some tests I've made, all give the same result:


            - Ran the web app on JBoss 6 and Tomcat

            - Played with different versions of included libs

            - Played with templates and different options to define xhtmls (with headers, ui tags, etc.)

            - Tried different JRE and JDK versions


            The behaviour is still the same: Most of components work except for some like datatable navigation or form validation.


            I'm sure I'm doing something terribly wrong. I remember I tried to play with RF4 some time before (it was v4.0.0 FInal) and I had absolutely no problems with those components.


            Just for the reference here're my web.xml, faces-config and test xhtml:


            <?xml version="1.0" encoding="UTF-8"?>
            <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
                      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
                      <display-name>Cambry v2.0</display-name>
                      <description>Cambry v2.0</description>
                           <servlet-name>Faces Servlet</servlet-name>
                           <servlet-name>Faces Servlet</servlet-name>



            <?xml version="1.0" encoding="UTF-8"?>
                     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"



            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                           <a4j:jsFunction name="initialLoad" action="#{managedBean1.initialLoad}" render="form_carros"/>
                              <f:facet name="header">
                                   <h:outputText value="Carritos admin"/>
                              <h:form id="form_carros">
                                    <rich:dataTable id="dt_carros" value="#{managedBean1.carros}" var="carro" rowKeyVar="row" rows="5">
                                              <f:facet name="header">Marca</f:facet>
                                              <h:outputText value="#{carro.marca}"/>
                                         <rich:column style="text-align: right;">
                                               <f:facet name="header">Modelo</f:facet>
                                               <h:outputText value="#{carro.modelo}"/>
                                          <rich:column style="text-align: right;">
                                               <f:facet name="header">Precio</f:facet>
                                               <h:outputText value="#{carro.precio}">
                                                         <f:convertNumber pattern="$#,###.00" type="currency" locale="es_MX"/>
                                          <rich:column style="text-align: center;">
                                               <f:facet name="header">Vendido</f:facet>
                                               <h:outputText value="#{carro.vendido?'Sí':'No'}"/>
                                          <f:facet name="footer">
                                                      <rich:dataScroller />
                                    <rich:messages showSummary="true" showDetail="false" ajaxRendered="true" style="color: red;"/>
                      <script type="text/javascript">
                      window.onload = initialLoad;



            Interesting observation: When I click any of datascroller's links a rich:messages shows an error: The button/link/text component needs to have a Form in its ancestry. Please add <h:form>.

            • 3. Re: rich:dataScroller doesn't work (Richfaces 4.2.0)
              Akaine Harga Novice

              Finally I made it work. Still I would very like to hear why that was happening...


              The problem seems was with 2 forms I had. If I put both my a4j:jsFunction and rich:panel inside 1 form all works fine. As soon as I separate them datascroller stops working.


              I'm really too tired to investigate the real cause (probably rendering/js_dom_tree processing nature) so if anyone has spare time it would be nice to understand the issue.

              • 4. Re: rich:dataScroller doesn't work (Richfaces 4.2.0)
                Maheswara Sunkara Novice

                check this: http://www.coderanch.com/t/523225/JSF/java/JSF-GlassFish


                And, reg your observation; you don't get this message if you change your javax.faces.PROJECT_STAGE to 'Production'

                • 5. Re: rich:dataScroller doesn't work (Richfaces 4.2.0)
                  Sabyasachi Rout Newbie


                  I am using DataScroller with 4.2.0 Final

                  Its working perfectly except when filtering is done on the DataTable.

                  As there is no render tag for DataTable, on filtering the pagination of dataScroller is still coming although the data is limited to a single page.

                  (Previously reRendering the dataScroller solved the question)

                  Any ideas on how to implement it?