3 Replies Latest reply on Jun 18, 2009 2:14 AM by Tim

    exceptions to please wait modalPanel

    Arbi Sookazian Master

      I am using a "please wait..." modalPanel for all a4j:/rich: AJAX activity as follows:

       <rich:modalPanel id="mpWait"
       style="text-align:center"
       height="100"
       width="150">
       <h:form>
       <h:panelGrid>
       <h:outputText value="Please wait..."
       style="font-weight:bold;font-size:large"/>
       <rich:spacer height="20"/>
       <h:graphicImage value="/img/spinner.gif"/>
       </h:panelGrid>
       </h:form>
       </rich:modalPanel>
      
       <a4j:status id="actionStatus"
       onstart="Richfaces.showModalPanel('mpWait')"
       onstop="Richfaces.hideModalPanel('mpWait')"/>


      This code is imported into all of my xhtml pages using:

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


      I would like to prevent the modalPanel from displaying in the case of a selection from HtmlSelectOneMenu and a4j submission.

      For example:

      <h:selectOneMenu id="findingCodeMenu"
      value="#{repairCaseDetails.selectedListValueForFindingCode}"
      required="true"
      validator="seamValidatorCodes">
       <s:selectItems var="lve"
       value="#{populateDropDown.getListValueList('FINDING_CODE')}"
       label="#{lve.code}"
       noSelectionLabel="Please Select..."/>
      <s:convertEntity/>
      <a4j:support event="onchange"
      ajaxSingle="true"
      reRender="findingCodeDecorator, updateFindingCodeBtn, findingCodeDesc1"/>
      </h:selectOneMenu>


      How can I prevent the please wait modalPanel from displaying in this case? The goal is to only show the modalPanel when user clicks a4j:commandButton or a4j:commandLink (or some other similar action activity from user). thx.

        • 1. Re: exceptions to please wait modalPanel
          Tim Newbie

          hi,

          you could use the showWhenRenderedattribute from the modal panel.
          you can bind it to a bean and set it to true whenever you need it. and to show it, you just need to rerender it from the buttons/links.
          closing the modal can be realised by the oncomplete tag of a commandbutton/-link.

          kind regards,
          tim

          • 2. Re: exceptions to please wait modalPanel
            Arbi Sookazian Master

             

            "timbooo" wrote:
            hi,

            you could use the showWhenRenderedattribute from the modal panel.
            you can bind it to a bean and set it to true whenever you need it. and to show it, you just need to rerender it from the buttons/links.


            could you plz provide an example of this approach? thx.

            • 3. Re: exceptions to please wait modalPanel
              Tim Newbie

               

              "asookazian" wrote:
              "timbooo" wrote:
              hi,

              you could use the showWhenRenderedattribute from the modal panel.
              you can bind it to a bean and set it to true whenever you need it. and to show it, you just need to rerender it from the buttons/links.


              could you plz provide an example of this approach? thx.


              well, if you're doing it the following way, you have to get rid of the a4j:status part in your pleaseWaitModalPanel.xhtml.
              i think there's an even easier way as described above to accomplish your needs.

              your modalPanel has to look sth. like that (nothing special):
              <rich:modalPanel id="yourModalPanel">
               <h:form id="yourModalPanelForm">
               Whatever you need in your modalPanel.
               </h:form>
              </rich:modalPanel>


              and all the buttons that should show your wait modal panel (and only these ones) should look sth. like that (oncomplete and rich:componentControl are important):
              <a4j:commandButton id="myButton"
               action="#{yourBean.yourAction}"
               value="MyButton"
               oncomplete="Richfaces.hideModalPanel('yourModalPanel');">
               <rich:componentControl for="yourModalPanel" attachTo="myButton"
               operation="show" event="onclick" />
              </a4j:commandButton>


              hope this helps.

              tim.