7 Replies Latest reply on Jun 14, 2010 10:30 AM by harpritt

    combining a4j:status and rich:effect and delayed content loa

    mark77

      Hi,

      i am playing around with a4j:status and the rich:effect.

      I have one region of the screen, capsulated in an a4j:outputPanel, which is dynamically rerendered. Now I want that region to fade out before it is reRendered and getting faded in after its content is fetched. How can I achieve this ?

      The second thing I'd need: I've seen a cool effect on the JIRA page: They place some panels on the dashboard (which shows up quite fast) and after the main page is loaded, they dynamically fetch the contents of the panels showing an gif while the content is fetched. This way - of course - the main page shows up quite fast, while the calculation of the panel contents is done afterwards.
      How can I achieve the same effect ?

      Br, Mark

        • 1. Re: combining a4j:status and rich:effect and delayed content
          ilya_shaikovsky

          1) use onstart and onstop and call effect functions registered by using name attribute on rich:effect.

          2) use jquerry to catch document ready event and call registered jsFunction which will fetch additional data.

          • 2. Re: combining a4j:status and rich:effect and delayed content
            mark77

            Hi Ilya,

            thanks for your reply.

            1) I already tried this - a4j is too fast :-) the panel starts its effect but the effect is aborted because the new content is already fetched before the effect is finished...

            2) OK, i hoped there was an easy way like an attribute "loadAsync" or something like that. :-) So, I'll dive into jquery. Something like:

            <rich:panel loadAsync="true">
            <a4j:include viewId="longCalc.jsf"/>
            </rich:panel>
            

            Br, Mark

            • 3. Re: combining a4j:status and rich:effect and delayed content
              ilya_shaikovsky

               

              1) I already tried this - a4j is too fast :-)


              you could specify delays using parameters.

              • 4. Re: combining a4j:status and rich:effect and delayed content
                mark77

                 

                "ilya_shaikovsky" wrote:
                1) I already tried this - a4j is too fast :-)


                you could specify delays using parameters.


                this sounds interesting - how can i add a delay here, so that the effect that will be called upon mystat's onstart first runs through and then the ajax request from the link click takes place ?

                <a4j:status id="mystat">
                ...
                </a4j:status>
                <a4j:outputPanel id="change">
                 ...
                 <a4j:commandLink action="#{someBean.action}" reRender="change" status="mystat"/>
                 ...
                </a4j:outputPanel>
                


                • 5. Re: combining a4j:status and rich:effect and delayed content
                  mark77

                  So, fading out before ajax'ed reRendering works this way:

                  <a4j:outputPanel id="cmsBlock">
                  <a4j:commandLink requestDelay="1000" status="cmsstatus" value=">> Back <<" action="#{richFacesBean.cmsBack}" reRender="cmsBlock">
                   <rich:effect event="onclick" for="cmsBlock" type="SwitchOff" params="duration:0.8,from:1.0,to:0.0" />
                   </a4j:commandLink>
                  </a4j:outputPanel>
                  


                  But I still have no glue, how to Fade the Panel in once it is reloaded. Any idea?

                  Br, Markus

                  • 6. Re: combining a4j:status and rich:effect and delayed content
                    ilya_shaikovsky

                    Call the fade in effect on oncomplete. Add also some delay in order to guaranty that if the request will be complete in less than fade out duration - it will be called later.

                    • 7. Re: combining a4j:status and rich:effect and delayed content
                      harpritt

                      Hi

                       

                      been struggling with point 1 from the origional post since before lunch

                       

                      I cant see what im doing wrong, if i replace the effect with a javascript function everything works fine..

                       

                      all help is greatly appreciated.

                      
                      <a4j:status id="commonstatus" onstop="fade2();" />
                      <rich:effect name="fade2" type="Highlight" for="currentSummaryMinus1" params="duration:1, startcolor:'#cccccc'" />
                      
                      
                      
                      
                      


                      Harpritt