9 Replies Latest reply on May 15, 2011 11:55 AM by Ilya Shaikovsky

    Wait Modal

    lessonz Newbie

      Okay, I have a h:CommandButton that I want to kick off a process on the server side. At the same time I want it to show a modal. That's working. Once the process on the server side is complete, I want to rerender the modal. That's where I get hung up.

       

      So basically, I want to launch a wait modal/dialog, letting the user know something is going on. Once that is done, I want to provide that feedback to the user by re-rendering the modal.

       

      I can't seem to figure out how to do this. Any direction, especially examples, would be greatly appreciated! Thanks.

        • 1. Wait Modal
          lessonz Newbie

          Surely someone has had to do similar.

          • 2. Wait Modal
            Oliver Vesper Newbie

            No idea how to achieve that, but I would also be interested in a possible solution - whereas I would prefer the modal to disappear automatically once the server-process is finished.

             

            -Oliver

            • 3. Wait Modal
              lessonz Newbie

              Oliver, thanks for the interest. I would imagine the solution to both of our inquiries would be similar if not the same. Hopefully someone out there can help.

              • 4. Wait Modal
                lessonz Newbie

                So, I know this must have something to do with an ajax push, but I'm just not seeing any good documentation on how to do this with RichFaces.    

                • 5. Wait Modal
                  Daniel Lechner Novice

                  I would try to do the following: In some bean, create an accessible attribute which indicates that the process has been finished.

                   

                  <rich:modalPanel id="modal" ....>

                    <h:form id="pollForm">

                      <a4j:poll interval="xxx" enabled="#{not bean.finished}" reRender="modal" />

                    </h:form>

                   

                    <h:panelGroup rendered="#{not bean.finished} >

                      "please wait" notification

                    </h:panelGroup>

                    <h:panelGroup rendered="#{bean.finished} >

                      content for finished (like button for closing the modalPanel...)

                    </h:panelGroup>

                  <rich:modalPanel ....>

                  • 6. Wait Modal
                    Kike Gil Novice

                    You can try this:

                     

                    you must create a status --->

                    <a4j:status name="LoadingStatus" onstart="#{rich:component('Loading')}.show();" onstop="#{rich:component('Loading')}.hide();" />

                    <rich:popupPanel ......>

                         <h:outputLabel value="wait please...">

                    </rich:popupPanel>

                     

                    The h:commandButton that you use must replace to a4j:commandButton

                    and in the a4j:commandButton add the attribute status:

                    <a4j:commandButton actionListener or action="#{nameBean.method}" status="LoadingStatus"/>

                     

                    when you pulse the button the popup will open, when the process with the server finish, the popup will close

                    • 7. Wait Modal
                      lessonz Newbie

                      In the end I opted to use onclick="#{rich:component('testPopup')}.show();" and some hide() with two different modals to switch them out when appropriate. It's not ideal, but it seems to work okay.

                       

                      Thanks.

                      • 8. Wait Modal
                        Ilya Shaikovsky Master

                        in order to minimize count of code to be added - you could use onsubmit on form. (But in that case panels from a4j:status and onsubmit should be checked to be called once)

                        • 9. Wait Modal
                          Ilya Shaikovsky Master

                          But that's true, the designed case - calling from a4j:status. But that works for ajax controls only.