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

      Hello,

       

      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">
                          <rich:column>
                                    <f:facet name="header">Brand</f:facet>
                                    <h:outputText value="#{car.brand}"/>
                          </rich:column>
                          <rich:column style="text-align: right;">
                                    <f:facet name="header">Model</f:facet>
                                    <h:outputText value="#{car.model}"/>
                          </rich:column>
                          <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"/>
                                    </h:outputText>
                          </rich:column>
                          <rich:column style="text-align: center;">
                                    <f:facet name="header">Sold</f:facet>
                                    <h:outputText value="#{car.sold?'Y':'N'}"/>
                          </rich:column>
                          <f:facet name="footer">
                                    <rich:dataScroller id="ds_cars" for="dt_cars" page="#{managedBean1.page}"/>
                          </f:facet>
                </rich:dataTable>
      </h:form>
      

       

      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:

           

          <rich:dataScroller/>

           

          ... 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"
                      version="3.0">
            
                      <display-name>Cambry v2.0</display-name>
                      <description>Cambry v2.0</description>
            
                      <welcome-file-list>
                           <welcome-file>app</welcome-file>
                      </welcome-file-list>
            
                      <servlet>
                           <servlet-name>StartupServlet</servlet-name>
                           <servlet-class>org.cambry2.test.StartupServlet</servlet-class>
                      </servlet>
            
                      <servlet-mapping>
                           <servlet-name>StartupServlet</servlet-name>
                           <url-pattern>/app</url-pattern>
                      </servlet-mapping>
            
                      <servlet>
                           <servlet-name>Faces Servlet</servlet-name>
                           <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                           <load-on-startup>1</load-on-startup>
                      </servlet>
                      <servlet-mapping>
                           <servlet-name>Faces Servlet</servlet-name>
                           <url-pattern>*.faces</url-pattern>
                      </servlet-mapping>
                      <context-param>
                           <param-name>org.richfaces.skin</param-name>
                           <param-value>classic</param-value>
                      </context-param>
            </web-app>
            

             

             

            <?xml version="1.0" encoding="UTF-8"?>
            <faces-config
                     xmlns="http://java.sun.com/xml/ns/javaee"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
                     version="2.1">
            
                    <converter>
                           <converter-id>converterSI</converter-id>
                           <converter-class>org.cambry2.converter.SIConverter</converter-class>
                      </converter>
            
                      <validator>
                               <validator-id>validatorSI</validator-id>
                               <validator-class>org.cambry2.validator.SIValidator</validator-class>
                      </validator>
            
            </faces-config>
            

             

             

            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                      xmlns:h="http://java.sun.com/jsf/html"
                      xmlns:f="http://java.sun.com/jsf/core"
                      xmlns:ui="http://java.sun.com/jsf/facelets"
                      xmlns:a4j="http://richfaces.org/a4j"
                      xmlns:rich="http://richfaces.org/rich">
            <f:view>
            <h:head/>
            <h:body>
                    <h:form>
                           <a4j:jsFunction name="initialLoad" action="#{managedBean1.initialLoad}" render="form_carros"/>
                      </h:form>
            
                    <rich:panel>
                              <f:facet name="header">
                                   <h:outputText value="Carritos admin"/>
                              </f:facet>
            
                              <h:form id="form_carros">
                                    <rich:dataTable id="dt_carros" value="#{managedBean1.carros}" var="carro" rowKeyVar="row" rows="5">
                                         <rich:column>
                                              <f:facet name="header">Marca</f:facet>
                                              <h:outputText value="#{carro.marca}"/>
                                         </rich:column>
                                         <rich:column style="text-align: right;">
                                               <f:facet name="header">Modelo</f:facet>
                                               <h:outputText value="#{carro.modelo}"/>
                                          </rich:column>
                                          <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"/>
                                               </h:outputText>
                                          </rich:column>
                                          <rich:column style="text-align: center;">
                                               <f:facet name="header">Vendido</f:facet>
                                               <h:outputText value="#{carro.vendido?'Sí':'No'}"/>
                                          </rich:column>
                                          <f:facet name="footer">
                                                      <rich:dataScroller />
                                              </f:facet>
                                    </rich:dataTable>
            
                                    <rich:messages showSummary="true" showDetail="false" ajaxRendered="true" style="color: red;"/>
                          </h:form>
                    </rich:panel>
            
                      <script type="text/javascript">
                      window.onload = initialLoad;
                      </script>
            
            </h:body>
            </f:view>
            </ui:composition>
            

             

            Edit:

            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

                  Hi

                  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?