10 Replies Latest reply on Feb 11, 2009 6:17 AM by ilya_shaikovsky

    How to rerender on modalPanel close? a4j:support  does not w

      How to rerender on modalPanel close?
      I tried with

      <rich:modalPanel>
      <a4j:support event="onclose" reRender="output"/>
      </rich:modalPanel>
      


      but it does not seem to do anything (I am working with Richfaces 3.2.2)

      Thanks,


        • 1. Re: How to rerender on modalPanel close? a4j:support  does n

          I meant onhide, not onclose:

          
          <rich:modalPanel>
          <a4j:support event="onhide" reRender="output"/>
          </rich:modalPanel>
          
          
          


          • 2. Re: How to rerender on modalPanel close? a4j:support  does n

            rich:modalPanel has an attribute "onhide"

            A general hint: In my opinion it is never a good idea to put a4j:support on ajax-enabled RF-Components.

            • 3. Re: How to rerender on modalPanel close? a4j:support  does n

              Hi!



              fmarwede wrote:

              rich:modalPanel has an attribute "onhide"



              Yes, I know, that is why I posted the last time saying:



              I meant onhide, not onclose.



              what is wrong with using a4j:support on ajax-enabled RF-Components?

              AFAIK a4j:support it is the only way to trigger a re-render when a javascript event occurs (onhide can not trigger a re render by itself)

              • 4. Re: How to rerender on modalPanel close? a4j:support  does n

                 


                what is wrong with using a4j:support on ajax-enabled RF-Components?


                I quote the dev guide (6.24.4):


                The components: <a4j:commandLink> , <a4j:commandButton> , <a4j:poll> and others from RichFaces library are already supplied with <a4j:support> functionality and there is no necessity to add the support to them.


                I hope the RF-Team will clarify that for the specific theme her, if you don't trust me ;-)

                • 5. Re: How to rerender on modalPanel close? a4j:support  does n
                  thomas.m

                  Maybe you could put a reRender on the component that trigger your hide operation ? You should post your panel full code :)

                  • 6. Re: How to rerender on modalPanel close? a4j:support  does n
                    thomas.m
                    • 7. Re: How to rerender on modalPanel close? a4j:support  does n
                      nbelaevski

                       

                      "fmarwede" wrote:

                      what is wrong with using a4j:support on ajax-enabled RF-Components?


                      I quote the dev guide (6.24.4):


                      The components: <a4j:commandLink> , <a4j:commandButton> , <a4j:poll> and others from RichFaces library are already supplied with <a4j:support> functionality and there is no necessity to add the support to them.


                      I hope the RF-Team will clarify that for the specific theme her, if you don't trust me ;-)


                      Sure. In fact, this applies to the components that initiate AJAX requests itself and the main purpose is to prevent developers from various concurrent requests issues either as from unnecessary duplicate AJAX requests. rich:modalPanel doesn't produce any AJAX requests itself, so it is safe to use a4j:support with it.

                      • 8. Re: How to rerender on modalPanel close? a4j:support  does n
                        nbelaevski

                        This:

                        <h:form>
                         <a4j:status startText="start" />
                        
                         <rich:modalPanel id="mp" showWhenRendered="true">
                         <f:facet name="controls">
                         <a4j:outputPanel onclick="#{rich:component('mp')}.hide()">X</a4j:outputPanel>
                         </f:facet>
                        
                         <a4j:support event="onhide" />
                         </rich:modalPanel>
                        
                         </h:form>

                        works fine for me with 3.2.2.GA. The only issue I see is that a4j:support requires surrounding form, so you cannot use another components requiring form inside modalPanel. And for sure you can call a4j:jsFunction by onhide.

                        • 9. Re: How to rerender on modalPanel close? a4j:support  does n

                          Nick, thank you for this clarification. But for the sake of completeness: I think we discuss two different questions here at the same time.

                          1.) Can I use a4j:support inside a modal panel. The answer is yes. Please forgive me for my mistake.

                          2.) luxspes: "How to rerender on modalPanel close?" If understand this question correctly, I give an answer to that already here:

                          http://www.jboss.org/index.html?module=bb&op=viewtopic&t=150198

                          It seems to me that the following code would do the same thing:

                          
                          <a4j:jsFunction name="reRenderSomething" reRender="someId" />
                          
                          <rich:modalPanel ...
                          ...
                          
                          <a4j:support event="onhide" onsubmit[or oncomplete]="reRenderSomething()"/>
                           </rich:modalPanel>
                          
                          


                          Sorry, at the moment I have no possibility to test the html output of both.

                          • 10. Re: How to rerender on modalPanel close? a4j:support  does n
                            ilya_shaikovsky

                             

                            <a4j:jsFunction name="reRenderSomething" reRender="someId" />
                            
                            <rich:modalPanel ...
                            ...
                            
                            <a4j:support event="onhide" onsubmit[or oncomplete]="reRenderSomething()"/>
                             </rich:modalPanel>
                            
                            


                            Will not works good! It will cause two requests to be sent . one from support and the second from js function. It seems for me next should be better:

                            1) if you do not need to submit the panel data:
                            <h:form>
                            <a4j:jsFunction name="reRenderSomething" reRender="someId" />
                            <rich:modalPanel ... onhide="reRenderSomething();"
                            ...
                            
                            </rich:modalPanel>
                            </h:form>
                            

                            2) if you should submit data inside the panel:
                            <rich:modalPanel ... onhide="reRenderSomething();"
                            ...
                            <h:form>
                            <a4j:jsFunction name="reRenderSomething" reRender="someId" />
                            </h:form>
                            </rich:modalPanel>