6 Replies Latest reply on Mar 4, 2010 6:40 AM by nimo22

    a4j:push, a4j:poll - onenabled ondisabled

    nimo22

      I cannot find properties something like "onenabled" and "ondisabled" for a4j:push and 4j:poll:

       

      onenabled: action which is invoked when push or poll is enabled.

       

      ondisabled: action which is invoked when push or poll is disabled.

       

       

      For example:

       

      I set the enabled-propertie via variable:

       

      {code:xml}

      <a4j:poll enabled="#{enabled}" onenabled="#{doThisAction}" ondisabled="#{doThatAction}"/>

       

      <a4j:push enabled="#{enabled}" onenabled="#{doThisAction}" ondisabled="#{doThatAction}"/>

      {code:xml}

       

      It would be very sensefull. What are you thinking?

        • 1. Re: a4j:push, a4j:poll - onenabled ondisabled
          nimo22

          How can I fire a action after push or poll is disabled?

           

          With "oncomplete" the action is fired after each poll/push-request, but I need to fire the action when poll/push is completly disabled.

           

          for example:

           

          java-code:

           

          setPollEnabled(false);

           

          xhtml-code:

           

          <poll: enabled="pollEnabled" ...>

          <a4j:support oncomplete=".." reRender=".."/>

           

           

          You see, the point is, I need to reRender something on my page AFTER the poll/push is completly disabled!

           

          How can I do that?

          • 2. Re: a4j:push, a4j:poll - onenabled ondisabled
            ilya_shaikovsky
            You enabling and disabling poll/push via ajax from some action, isn't it? So why you just can't perform some needed actions during the disablement/enablement?
            • 3. Re: a4j:push, a4j:poll - onenabled ondisabled
              ilya_shaikovsky
              in general client event handlers can't exist because switching state not occurs at client side but changed at server side. So see no spot for them.
              • 4. Re: a4j:push, a4j:poll - onenabled ondisabled
                nimo22

                yes, I enable the poll via action - the enablement is triggered via view:

                 

                <a4j:commandButton action="doPollWork"/>

                 

                 

                yes, I disable the poll via action - but the disablement is not explicitly triggered from the view.

                 

                void task(){


                //long-running-process


                setPollDisabled(true);


                }

                 

                The poll is getting disabled..and now I need a reRender-Property:

                 

                I have no commandButton which disables the poll directly from the view, hence I cannot use reRender which should reRender view AFTER the disablement of the poll.

                 

                 

                The only solution I would see, is: to have an additionaly pull, which pulls the update of the view after polling is completly disabled. With pull I can reRender the View from my Java-Code directly. Is there another way?

                • 5. Re: a4j:push, a4j:poll - onenabled ondisabled
                  ilya_shaikovsky

                  if you need to add some zone for ajax render programatically during ajax request action/listener use :

                   

                  AjaxContext.getCurrentInstance().addComponentToAjaxRender(FacesContext.getCurrentInstance().getViewRoot(), "someIdToRender");
                  • 6. Re: a4j:push, a4j:poll - onenabled ondisabled
                    nimo22

                    Hello Ilya,

                     

                    THANK YOU

                     

                    !

                     

                    This Method is exactly what I need!