4 Replies Latest reply on Oct 24, 2012 8:49 AM by Max Rainer

    a4j:status and rich:popupPanel not working in 4.2.x

    Max Rainer Newbie

      Hi,

      I am trying to get a popup panel when waiting for ajax and closing that panel when ready.

      Popup panel "show" works fine, but hide doesn't.

      Popup panel stays open.

       

      Here's my code:

       

       

          <a4j:status>

              <f:facet name="start">

                   <rich:componentControl target="wait" operation="show" event="start" />

               </f:facet>

               <f:facet name="stop">

                   <rich:componentControl target="wait" operation="hide" event="stop" />

               </f:facet>

          </a4j:status>

       

       

      <rich:popupPanel

          id="wait" style="text-align:center" autosized="true" modal="true" width="200" >

                       <h:graphicImage value="/pages/images/ai.gif" alt="ai"/><br />

                       <h:outputText value="loading data..." />

      </rich:popupPanel>

        • 1. Re: a4j:status and rich:popupPanel not working
          Max Rainer Newbie

          I played around with status but I do not see any  ajax "stop" or "complete" message.

           

          So I changed the complete thing to my input request:

           

          ....

          <h:inputText value="#{phoneTableFilter.nameFilter}" size="14">

              <a4j:ajax render="phonetable" execute="@this" event="blur" immediate="true"

                  oncomplete="#{rich.component('cmpanelform:waitpop')}.hide(); return false;" />

          </h:inputText>

          .....

           

          firebug now tells me that I have a syntax error:

          SyntaxError: syntax error

           

          return new Function("event", handlerCode);

           

          When changing the oncomplete statement to:

           

          oncomplete="document.getElementById('cmpanelform:waitpop').hide(); return false;"

          firebug output:

          TypeError: document.getElementById("cmpanelform:waitpop").hide is not a function

           

          return new Function("event", handlerCode);

           

          For information:

          I am using RichFaces 4.2.3

           

          Thanks a lot

          Max

          • 2. Re: a4j:status and rich:popupPanel not working
            Radim Hanus Expert

            Hi Max,

             

            I use following construct and it works for me as expected:

             

            <rich:popupPanel id="nonModal" modal="false" autosized="true">

                 <h:graphicImage library="images" name="ai.gif"/>

                 <h:outputText value="Please wait...}"/>

            </rich:popupPanel>

            <a4j:status name="nonModalStatus"

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

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

             

            <h:form>

            <rich:extendedDataTable id="table" value="#{myBean}" var="x"

                                                columnClasses="center" selection="#{myBean.selection}"

                                                selectionMode="single" rows="20">

                            <a4j:ajax execute="@this"

                                      event="selectionchange"

                                      status="nonModalStatus"

                                      listener="#{myBean.rowSelectionListener}"

                                      render="toolbar"/>

             

                            <rich:column width="100px" sortBy="#{'name}" sortOrder="#{'ascending'}">

                            ...

            </rich:extendedDataTable>

            </h:form>

             

            when the selection on extended data table is changed non-modal popup is raised and when ajax request completes popup disapears

            note that both rich:popup and a4j:status aren't in form

            maybe you will find it usefull...

            1 of 1 people found this helpful
            • 3. Re: a4j:status and rich:popupPanel not working
              Max Rainer Newbie

              Hi Radim,

              thanks a lot for your example.

               

              I tried out and get a Javascript syntax error:

              {"onstart":function(event){.show()},"statusName":"waitLargeStatus"}...

               

              Seems to be a bug, isn't it?

               

              Here's my new code:

               

              <a4j:status name="waitLargeStatus"

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

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

                 

               

              <rich:popupPanel

                  id="waitLarge" style="text-align:center" autosized="true" modal="true" width="200" >

                               <h:graphicImage value="/pages/images/ai.gif" alt="ai"/><br />

                               <h:outputText value="loading data..." />

              </rich:popupPanel>

               

              <h:form>

              ......

              <a4j:ajax render="phonetable" execute="@this" event="blur" status="waitLargeStatus"/>

              ....

              </h:form>

              • 4. Re: a4j:status and rich:popupPanel not working
                Max Rainer Newbie

                this code works fine in 4.2.0 and 4.2.3:

                 

                <rich:popupPanel

                    id="waitModal" style="text-align:center" autosized="true" modal="true" width="200" >

                                 <h:graphicImage value="/pages/images/ai.gif" alt="ai"/><br />

                                 <h:outputText value="loading data..." />

                </rich:popupPanel>

                 

                <a4j:status name="waitModalStatus">

                    <f:facet name="start">

                        <rich:componentControl event="start" operation="show" target="waitModal" />

                    </f:facet>   

                    <f:facet name="stop">

                        <rich:componentControl event="stop" operation="hide" target="waitModal" />

                    </f:facet>

                </a4j:status>

                ....

                 

                <h:form>

                ....

                <rich:foo ...   status="waitModalStatus" />

                ....

                </h:form>

                 

                Still thinking that

                <a4j:status> with onstop and onstart has a bug.

                 

                Think I found another bug too:

                Component <rich:tab> is not working with "status" correctly.

                When switchType is ajax, status start and stop is not called.

                 

                Max