3 Replies Latest reply on Feb 12, 2013 6:06 AM by michpetrov

    PageSize causing delay in AjaxCall to show rich:poupup

    srinivas.sirigineedi

      Hi :

      I am currently running into this issue currently. Please see the below scenario as:

       

      Envrionment: Richfaces: 4.2.3.final

                          JSF 2.0.3

                          Websphere 7

                          Windows

       

       

      <html xmlns="http://www.w3.org/1999/xhtml"

          xmlns:a4j="http://richfaces.org/a4j"

          xmlns:rich="http://richfaces.org/rich"

          xmlns:h="http://java.sun.com/jsf/html">

       

      <ui:composition template="/myTemplate.xhtml">

          <ui:define name="Content">

       

              <h:form id="menuForm">

                  <rich:popupPanel id="myPopup" domElementAttachment="form">

                      <f:facet name="controls">

                          <h:graphicImage value="/close.gif"

                                          onclick="#{rich:component('myPopup')}.hide();" />

                      </f:facet>

       

                      <h:outputText value="#{myBean.actionType}" />

                  </rich:popupPanel>

       

                  <a4j:commandLink id="lnkBtn"

                                   execute="@this"

                                   limitRender="true"

                                   oncomplete="#{rich:component('myPopup')}.show();">

                      <f:setPropertyActionListener target="#{myBean.actionType}"

                                                   value="STANDARD" />

                  </a4j:commandLink>

              </h:form>

       

       

              <h:form id="dataForm">

       

                  <ui:include src="data1.xhtml" />

                  <ui:include src="data2.xhtml" />

                  <ui:include src="data3.xhtml" />

                  <ui:include src="data4.xhtml" />

                  <ui:include src="data5.xhtml" />

                  <ui:include src="data6.xhtml" />

                  <ui:include src="data7.xhtml" />

       

              </h:form>

       

          </ui:define>

      </ui:composition>

      </html>

       

      As our application grew larger we have lot of data to show in each view. The oncomplete action on a4j:commandLink in form "myForm" shows the richPoup. The issue here is as the size of the  included xhtmls in the second form "dataForm" increases, the popup is taking longer time to come up. Just for Testing purposes, i removed the ui:includes in the  Second Form and the richPopup shows instantly, otherwise,there is a delay of 4-5 seconds and gets worst with many <ui:includes> in the second form.

       

      I have used the a4j:log to see the ajax cycle and observed that the delay is between  'begin' and 'beforedomupdate' points. That leads to the point that it has to do with the JSF ViewState. Is the majority of time lost during the ViewState construction or it has to do with the amount of data that is being sent/received from server? Since i used execute="@this" on the commandLink, i am thinking that only that component will be processed on the server and why would the data in another form would have impact on the ajax calls. Is ther any way to avoid this significant delay?

       

       

      thanks

      cnu

        • 1. Re: PageSize causing delay in AjaxCall to show rich:poupup
          michpetrov

          Hi,

           

          I'd say the delay is caused by the browser itself waiting for the DOM to update (since you're waiting for oncomplete event). The solution is to show the popup on click rather than on complete:

           

          <rich:popupPanel id="myPopup" domElementAttachment="form">
              <f:facet name="controls">
                  <h:graphicImage value="/close.gif">
                      <rich:componentControl target="myPopup" operation="hide" event="click"/>
                   </h:graphicImage>
          
              </f:facet>
          
             <h:outputText value="#{myBean.actionType}" />
          </rich:popupPanel>
          
          …
          
          <a4j:commandLink id="lnkBtn"
                                       execute="@this"
                                       limitRender="true">
              <f:setPropertyActionListener target="#{myBean.actionType}"
                                                       value="STANDARD" />
               <rich:componentControl target="myPopup" operation="show" />   
          </a4j:commandLink>
          

           

          Although you should probably consider making your page smaller anyway.

          • 2. Re: PageSize causing delay in AjaxCall to show rich:poupup
            srinivas.sirigineedi

            Hi Michael: Changing to onclick from oncomplete wont help here .If you see the the code closely, the bean property is updated with propertyActionListener and the updated value will only be shown only after the Action is completed. Onclick will just show the popup but poup will still have to wait for the response from server to show the updated value.

            • 3. Re: PageSize causing delay in AjaxCall to show rich:poupup
              michpetrov

              cnu vas wrote:

               

              Hi Michael: Changing to onclick from oncomplete wont help here .If you see the the code closely, the bean property is updated with propertyActionListener and the updated value will only be shown only after the Action is completed. Onclick will just show the popup but poup will still have to wait for the response from server to show the updated value.

              I see, didn't check that, wouldn't using a4j:ajax solve that problem?

               

              <a4j:commandLink id="lnkBtn"
                                           execute="@this"
                                           limitRender="true">
                   <a4j:ajax listener="#{myBean.changeActionType('STANDARD')}" event="click" />
                   <rich:componentControl target="myPopup" operation="show" />   
              </a4j:commandLink>

              The value is updated right when I click.