13 Replies Latest reply on Jul 1, 2009 8:43 AM by tomba

    Datascroller with a4j:repeat problem

    tomba

      All,

      I wanted to use a rich:datascroller for an a4j:repeat. The api is ok, paging actually works as the stuff to display is being retrieved from the database, but my a4j:repeat is not re-rendered.

      I have this:

      <rich:datascroller align="center" reRender="resultview" for="resultview" renderIfSinglePage="false" binding="#{masterDataDetail.cmpDataScroller}" scrollerListener="#{masterDataDetail.switchPage}" maxPages="20" />


      Also, I tried re-rendering the page with the following:
      <a4j:commandButton reRender="resultview" value="rerender view" />


      But that didn't help either.
      After a full page refresh with the browser however the correct data is displayed.

      Is this a known problem with these components?
      I tried quite a bit but can't find a way to get it working.

      Thanks,
      Steven

        • 1. Re: Datascroller with a4j:repeat problem
          tomba

          I have been working a bit on this.
          Finally decided to temporarily replace the repeat with a regular dataTable, and that seems to work.

          I guess this is an a4j:repeat bug?

          • 2. Re: Datascroller with a4j:repeat problem
            tomba

            If it is of any value, here is the a4j definition:

            <a4j:repeat id="resultview" binding="#{masterDataDetail.cmpResults}"
             rows="25" value="#{masterDataDetail.items}" var="result">
            


            Also, items in this case is a list of hashmaps.

            • 3. Re: Datascroller with a4j:repeat problem
              nbelaevski

              Hi,

              Wrap a4j:repeat into a4j:outputPanel and reRender the panel explicitly.

              • 4. Re: Datascroller with a4j:repeat problem
                tomba

                 

                "nbelaevski" wrote:
                Hi,

                Wrap a4j:repeat into a4j:outputPanel and reRender the panel explicitly.

                That solution works in IE7 but consistently crashes Firefox 3.0 (it locks out "not responding") ...

                • 5. Re: Datascroller with a4j:repeat problem
                  tomba

                  And Firefox 3.5 crashes too btw :(

                  • 6. Re: Datascroller with a4j:repeat problem
                    ilya_shaikovsky

                    hm.. try to check a4j:log output.. and paste the code you finally using.

                    • 7. Re: Datascroller with a4j:repeat problem
                      tomba

                      Thank you for your quick reply.

                      Herewith the a4j log taken in chrome where it also works:
                      http://www.filefactory.com/file/ag97243/n/a4jlog_txt

                      In firefox I checked just before it crashed, and the last this I see is the "Request state: 4". I found there were more appearances of "Request state: 3" in firefox compared to chrome (not sure if this is relevant though).

                      The code in my jsp looks as follows:

                       <a4j:outputPanel id="presults">
                       <a4j:repeat id="resultview" binding="#{masterDataDetail.cmpResults}" rows="25" value="#{masterDataDetail.items}" var="result">
                       <table width="90%" style="border-width:0.25pt; border-style:solid; border-color:#000000">
                       <tr>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_nummer}" /> 
                       <h:outputLink value="transactiondatadetail.jsf">
                       <h:outputText value="#{result.contractnumber}"/>
                       <f:param name="contractnr" value="#{result.contractnumber}" />
                       <f:param name="ref" value="masterdatadetail" />
                       </h:outputLink>
                       </td>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_contractstatus}" />  <h:outputText value="#{result.contractstatus}"></h:outputText>
                       </td>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_servicecontractnumber}" />  <h:outputText value="#{result.servicecontractnumber}"></h:outputText>
                       </td>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_licenseplate}" />  <h:outputText value="#{result.licenseplate}"></h:outputText>
                       </td>
                       </tr>
                       </table>
                      
                       <table>
                       <tr>
                       <td>
                        
                       </td>
                       </tr>
                       </table>
                      
                       <table width="90%">
                       <tr>
                       <td width="45%" valign="top">
                       <table width="100%" style="border-width:0.25pt; border-style:solid; border-color:#000000">
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_driver}" />  <h:outputText value="#{result.fromdate}"/>
                       </td>
                       <td>
                       <h:outputText value="#{result.driver}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                        
                       </td>
                       <td>
                       <h:outputText value="#{result.address}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                        
                       </td>
                       <td>
                       <h:outputText value="#{result.postcode}"/>  <h:outputText value="#{result.city}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_employeenumber}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.employeenumber}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_customercostcenter}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.customercostcenter}"/>
                       </td>
                       </tr>
                       </table>
                      
                       <table>
                       <tr>
                       <td>
                        
                       </td>
                       </tr>
                       </table>
                      
                       <table width="100%" style="border-width:0.25pt 0.25pt 0.25pt 0.25pt; border-style:solid; border-color:#000000">
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_firstregistrationdate}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.firstregistrationdate}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_distancemileage}"/>
                       </td>
                       <td>
                       <h:outputText value="#{result.distancemileage}">
                       <f:convertNumber maxFractionDigits="0" />
                       </h:outputText>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_contractmileageperannum}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.contractmileageperannum}">
                       <f:convertNumber maxFractionDigits="0" />
                       </h:outputText>
                       </td>
                       </tr>
                       </table>
                       </td>
                      
                       <td width="45%" valign="top" align="right">
                       <table width="100%" style="border-width:0.25pt; border-style:solid; border-color:#000000">
                       <tr>
                       <td width="120px">
                       <h:outputText value="#{msg.masterDataDetail_make}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.make}"/>
                       </td>
                       </tr>
                       <tr>
                       <td valign="top">
                       <h:outputText value="#{msg.masterDataDetail_type}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.vehicledescription}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_bodystyle}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.bodystyle}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_schwackecode}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.schwackecode}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_cc}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.cc}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_kw}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.kw}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_fueltype}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.fueltype}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_chassisnumber}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.chassisnumber}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_code}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.code}"/>
                       </td>
                       </tr>
                       </table>
                       </td>
                       </tr>
                       </table>
                      
                       <table>
                       <tr>
                       <td>
                        
                       </td>
                       </tr>
                       </table>
                      
                       <table width="90%" style="border-width:0.25pt; border-style:solid; border-color:#000000;background-color:#dddddd">
                       <tr>
                       <td>
                        
                       </td>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_contractinfo1}" />
                       </td>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_contractinfo2}" />
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_contractinfo3}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.contractstart}"/>
                       </td>
                       <td>
                        
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_contractinfo4}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.contractend}"/>
                       </td>
                       <td>
                        
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_contractinfo5}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.contractduration}">
                       <f:convertNumber maxFractionDigits="0" />
                       </h:outputText>
                       </td>
                       <td>
                        
                       </td>
                       </tr>
                       </table>
                      
                       <table>
                       <tr>
                       <td>
                        
                       </td>
                       </tr>
                       </table>
                      
                       <table width="90%" style="border-width:0.25pt; border-style:solid; border-color:#000000">
                       <tr>
                       <td style="font-weight:bold" align="right">
                       <h:outputText value="#{msg.masterDataDetail_billplaninfo1}" />
                       </td>
                       <td style="font-weight:bold" align="right">
                       <h:outputText value="#{msg.masterDataDetail_billplaninfo2}" />
                       </td>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_billplaninfo3}" />
                       </td>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_billplaninfo4}" />
                       </td>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_billplaninfo5}" />
                       </td>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_billplaninfo6}" />
                       </td>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_billplaninfo7}" />
                       </td>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_billplaninfo8}" />
                       </td>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_billplaninfo9}" />
                       </td>
                       </tr>
                      
                       <a4j:repeat var="subresult" value="#{result.BillPlan_Set}" id="subreportresult">
                       <tr>
                       <td>
                       <h:outputText value="#{subresult.startdatebilledperiod}"/>
                       </td>
                       <td>
                       <h:outputText value="#{subresult.todate}"/>
                       </td>
                       <td style="text-align:right">
                       <h:outputText value="#{subresult.billduration}">
                       <f:convertNumber pattern="#0.00" />
                       </h:outputText>
                       </td>
                       <td style="text-align:right">
                       <h:outputText value="#{subresult.numberofpayments}">
                       <f:convertNumber maxFractionDigits="1" />
                       </h:outputText>
                       </td>
                       <td style="text-align:right">
                       <h:outputText value="#{subresult.financeamount}">
                       <f:convertNumber pattern="#0.00" />
                       </h:outputText>
                       </td>
                       <td style="text-align:right">
                       <h:outputText value="#{subresult.financeamountvat}">
                       <f:convertNumber pattern="#0.00" />
                       </h:outputText>
                       </td>
                       <td style="text-align:right">
                       <h:outputText value="#{subresult.serviceamount}">
                       <f:convertNumber pattern="#0.00" />
                       </h:outputText>
                       </td>
                       <td style="text-align:right">
                       <h:outputText value="#{subresult.serviceamountvat}">
                       <f:convertNumber pattern="#0.00" />
                       </h:outputText>
                       </td>
                       <td style="text-align:right">
                       <h:outputText value="#{subresult.overallamount}">
                       <f:convertNumber pattern="#0.00" />
                       </h:outputText>
                       </td>
                       </tr>
                       </a4j:repeat>
                       </table>
                      
                       <table width="90%" style="border-width:0.25pt; border-style:solid; border-color:#000;margin-top:1em">
                       <tr>
                       <td width="15%">
                       <h:outputText value="#{msg.masterDataDetail_upelistpriceplusvat}: " />
                       </td>
                       <td width="18%">
                       <h:outputText value="#{result.upelistpriceplusvat}">
                       <f:convertNumber maxFractionDigits="2" />
                       </h:outputText>
                       </td>
                       <td width="30%">
                       <h:outputText value="#{msg.masterDataDetail_fleetliveoffernumber}: " />
                       <h:outputText value="#{result.firstcvrequest_reference}"/>
                       </td>
                       <td width="37%">
                       <h:outputText rendered="#{masterdatadetail.parentextlbglnetto == 1}" value="#{msg.masterDataDetail_externallbgl}: " />
                       <h:outputText rendered="#{masterdatadetail.parentextlbglnetto == 1}" value="#{result.externallbgl}">
                       <f:convertNumber maxFractionDigits="2" />
                       </h:outputText>
                        <h:outputText rendered="#{masterdatadetail.parentdiscount == 1}" value="#{result.discount}">
                       <f:convertNumber pattern="(##0.00%)"/>
                       </h:outputText>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_upenet}: " />
                       </td>
                       <td>
                       <h:outputText value="#{result.upenet}">
                       <f:convertNumber maxFractionDigits="2" />
                       </h:outputText>
                       </td>
                       <td colspan="2">
                       <h:outputText value="#{msg.masterDataDetail_dealer}: " /> <h:outputText value="#{result.dealer}"/>
                       </td>
                       </tr>
                       <tr>
                       <td>
                       <h:outputText rendered="#{masterdatadetail.parentrestwert == 1}" value="#{msg.masterDataDetail_residualvaluenet}: " />
                       </td>
                       <td>
                       <h:outputText rendered="#{masterdatadetail.parentrestwert == 1}" value="#{result.residualvaluenet}">
                       <f:convertNumber maxFractionDigits="2" />
                       </h:outputText> <h:outputText rendered="#{masterdatadetail.parentrestwert == 1}" value="#{result.rvaspercofupenet}">
                       <f:convertNumber pattern="(##0.00%)"/>
                       </h:outputText>
                       </td>
                       <td colspan="2">
                       <h:outputText rendered="#{masterdatadetail.parentgarant == 1}" value="#{msg.masterDataDetail_rvguarantor}: " />
                       <h:outputText rendered="#{masterdatadetail.parentgarant == 1}" value="#{result.rvguarantor}"/>
                       </td>
                       </tr>
                       </table>
                      
                       <table width="90%" style="border:0.25pt solid #000;margin-top:1em">
                       <tr>
                       <td style="font-weight:bold">
                       <h:outputText value="#{msg.masterDataDetail_Versicherungsklassen}" />
                       </td>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_thirdparty}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.thirdparty}">
                       <f:convertNumber maxFractionDigits="2" />
                       </h:outputText>
                       </td>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_fullcomprehensive}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.fullcomprehensive}">
                       <f:convertNumber maxFractionDigits="2" />
                       </h:outputText>
                       </td>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_partialcover}" />
                       </td>
                       <td>
                       <h:outputText value="#{result.partialcover}">
                       <f:convertNumber maxFractionDigits="2" />
                       </h:outputText>
                       </td>
                       </tr>
                       </table>
                      
                       <table width="90%" style="border:0.25pt solid #000;margin-top:1em">
                       <tr>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_excessdistancerm}"/>
                       </td>
                       <td>
                       <h:outputText value="#{result.excessdistancerm}">
                       <f:convertNumber maxFractionDigits="3" />
                       </h:outputText>
                       </td>
                       <td>
                       <h:outputText value="#{msg.masterDataDetail_lessdistancerm}"/>
                       </td>
                       <td>
                       <h:outputText value="#{result.lessdistancerm}">
                       <f:convertNumber maxFractionDigits="3" />
                       </h:outputText>
                       </td>
                       </tr>
                       </table>
                      
                       <div style="width:90%;background-color:#000;margin:1em 0"> </div>
                       </a4j:repeat>
                       </a4j:outputPanel>
                       <a4j:log popup="false" level="ALL" style="width: 800px; height: 300px;"></a4j:log>
                       <rich:spacer height="10" />
                       <rich:datascroller align="center" reRender="presults" for="resultview" renderIfSinglePage="false" binding="#{masterDataDetail.cmpDataScroller}" scrollerListener="#{masterDataDetail.switchPage}" maxPages="20" />
                      


                      • 8. Re: Datascroller with a4j:repeat problem
                        tomba

                        There's more...

                        In all browsers that work, this code also regularly triggers a duplicate id exception:

                        duplicate Id for a component searchForm:resultview:j_id52


                        For example, when clicking a link in the a4j:repeat component somewhere, on the next page click a link to go back, and it's messed up (sometimes the first time, sometimes only after a couple of tries).

                        • 9. Re: Datascroller with a4j:repeat problem
                          ilya_shaikovsky

                          which is the scope of masterDataDetail objetc? session scoped bindings causes duplicate Id exception.

                          • 10. Re: Datascroller with a4j:repeat problem
                            tomba

                             

                            "ilya_shaikovsky" wrote:
                            which is the scope of masterDataDetail objetc? session scoped bindings causes duplicate Id exception.

                            Yes it's on session, but I can't really change that. Any ideas?

                            I'm pretty baffled by the firefox problems, it never failed me like that and I can't deliver before getting it solved.

                            • 11. Re: Datascroller with a4j:repeat problem
                              ilya_shaikovsky

                              http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4240157#4240157
                              See Nick's explanation.

                              you have to change the scope of the binding object. Separate your data Objects and view Obejcts and feel free to keep data in session but have request scoped accessors to components.

                              • 12. Re: Datascroller with a4j:repeat problem
                                tomba

                                A little more in the firefox problem.
                                Here is the regular flow in a working browser:

                                debug[13:05:20,995]: NEW AJAX REQUEST !!! with form: searchForm
                                debug[13:05:20,995]: Start XmlHttpRequest
                                debug[13:05:20,995]: Reqest state : 1
                                debug[13:05:20,996]: QueryString: AJAXREQUEST=j_id_jsp_633498102_0&searchForm=searchForm&searchForm%3Acustomer=635366&searchForm%3Acustomer=635366&searchForm%3Amake=300163&searchForm%3Adriver=&searchForm%3Amodel=&searchForm%3Atype=&searchForm%3AemployeeNumber=&searchForm%3Aconfiguration=&searchForm%3AcontractNumber=&searchForm%3Anature=&searchForm%3AcostCenter=&searchForm%3Afuel=&searchForm%3AserviceContract=&searchForm%3Astatus=&searchForm%3Anumber=&searchForm%3Adealer=&searchForm%3AnumberPlate=&searchForm%3AfromDateInputDate=&searchForm%3AfromDateInputCurrentDate=06%2F2009&searchForm%3AtoDateInputDate=&searchForm%3AtoDateInputCurrentDate=06%2F2009&javax.faces.ViewState=j_id4&ajaxSingle=searchForm%3Aj_id_jsp_633498102_183&searchForm%3Aj_id_jsp_633498102_183=2&AJAX%3AEVENTS_COUNT=1&
                                debug[13:05:22,581]: Reqest state : 2
                                debug[13:05:22,582]: Reqest state : 3
                                debug[13:05:22,584]: Reqest state : 3
                                debug[13:05:22,584]: Reqest state : 3
                                debug[13:05:22,584]: Reqest state : 3
                                debug[13:05:22,585]: Reqest state : 3
                                debug[13:05:22,585]: Reqest state : 3
                                debug[13:05:22,586]: Reqest state : 4
                                debug[13:05:22,586]: Reqest end with state 4
                                debug[13:05:22,586]: Response with content-type: text/xml;charset=UTF-8
                                


                                In firefox, this is the last this I view in the log:
                                debug[13:05:20,995]: NEW AJAX REQUEST !!! with form: searchForm
                                debug[13:05:20,995]: Start XmlHttpRequest
                                debug[13:05:20,995]: Reqest state : 1
                                debug[13:05:20,996]: QueryString: AJAXREQUEST=j_id_jsp_633498102_0&searchForm=searchForm&searchForm%3Acustomer=635366&searchForm%3Acustomer=635366&searchForm%3Amake=300163&searchForm%3Adriver=&searchForm%3Amodel=&searchForm%3Atype=&searchForm%3AemployeeNumber=&searchForm%3Aconfiguration=&searchForm%3AcontractNumber=&searchForm%3Anature=&searchForm%3AcostCenter=&searchForm%3Afuel=&searchForm%3AserviceContract=&searchForm%3Astatus=&searchForm%3Anumber=&searchForm%3Adealer=&searchForm%3AnumberPlate=&searchForm%3AfromDateInputDate=&searchForm%3AfromDateInputCurrentDate=06%2F2009&searchForm%3AtoDateInputDate=&searchForm%3AtoDateInputCurrentDate=06%2F2009&javax.faces.ViewState=j_id4&ajaxSingle=searchForm%3Aj_id_jsp_633498102_183&searchForm%3Aj_id_jsp_633498102_183=2&AJAX%3AEVENTS_COUNT=1&
                                debug[13:05:22,581]: Reqest state : 1
                                


                                Not sure if it's relevant of course, but after logging AJAXREQUEST firefox is back in "request state : 1", something I cannot produce in any of the working browsers.

                                Any thoughts?

                                • 13. Re: Datascroller with a4j:repeat problem
                                  tomba

                                  One more thing maybe... is it possible to invoke a page reload when paging through the results instead of making an AJAX call? It is worth the try for me.