3 Replies Latest reply on Jun 3, 2013 11:22 AM by Sama Teyha

    a4j:status onstop never called

    nimo stephan Master

      I am using a4j:status and the onstop is never called:


      {code}

      <h:form id="form">
      <a4j:status onstart="#{rich:component('splash')}.show()" onstop="#{rich:component('splash')}.hide()" />

      <h:panelGroup id="myPanel">     

      <h:outputText value=".."/>
      <a4j:commandButton id="myAction" action=".." render="myPanel"></a4j:commandButton>
      </h:panelGroup>

      </h:form>

      {code}

       

      After clicking myAction. I render "myPanel" and the onstop of a4j:status is never called.

       

      When I use something like this, then the onstop is called successfully:

       

      {code}

      <h:form id="form">
      <a4j:status onstart="#{rich:component('splash')}.show()" onstop="#{rich:component('splash')}.hide()" />

      <a4j:commandButton id="myAction" action=".." render="myPanel"></a4j:commandButton>

      <h:panelGroup id="myPanel">

      <h:outputText id="myText" value=".."/>

      <!--other components to render after ajax-update-->

      </h:panelGroup>

      </h:form>

      {code}

       

      So you see, I have to exclude the commandButton "myAction" from the rendered "myPanel" to have it worked. However, I need the actionButton within myPanel and dont want to use render="myText".

       

      Is this a bug? Is this related to https://issues.jboss.org/browse/RF-10853#comment-12743505?

        • 1. Re: a4j:status onstop never called
          Sama Teyha Newbie

          Hi Nimo,

          have you found a solution to this problem? I'm experiencing the same problem.

          I currently workaround the problem by doing sometihng like this

          <a4j:commandButton id="myAction" action=".." render="myPanel" oncomplete="callOnStatusOnstop();" /> but I don't think this is a very appropriat solution.

          I Would very much appreciate a better solution from the community.

          • 2. Re: a4j:status onstop never called
            Siva P Master

            Hi,

             

            better to make the code reuse of it,create like below

             

            1) Copy all the code inside a4j:region tag and specifiy the id for the tag.

            2) After closing the region in page or modelpanel add the below code ,

                

            <a4j:status for="id"

                        onstart="#{rich:component("modelpanelID')}.show()"

                        onstop="#{rich:component("modelpanelID')}.hide()" />

             

            3) Include the code after the step2.

             

                      <a4j:include id="loadWindow" viewId="loading_page.jsp"></a4j:include>

             

            4) add the code in separete page,(loading_page.jsp)

             

                 <rich:modalPanel id="wait" autosized="true" width="50" height="50"

                    moveable="false" resizeable="false">

                   <h:graphicImage alt="Please Wait..." value="image/loading.gif"></h:graphicImage>

                 </rich:modalPanel>

            5) you need to add the status in commandbutton also to show in the screen.

             

            it will show the loading icon where ever you want it.

            • 3. Re: a4j:status onstop never called
              Sama Teyha Newbie

              Hi,

              the problem is not  how to  use or display the busy status but  how to sop it once started.

              the onstart() method is called when an ajax request is fired but the  onstop()  method of the script is not called when the  request is over.