7 Replies Latest reply on Feb 25, 2008 4:00 AM by mail.micke

    reRender blocks oncomplete call with Modalpanel (bug?)

      Hi,

      I don't know if this is a bug or maybe I did sth. wrong...

      I have a commandLink that rerenders my modalpanel (to populate changes) and calls the showModalPanel function oncomplete. The problem is, that as soon as I set the reRender on the ModalPanel, the Modalpanel won't show up, I think oncomplete function is not called. Here is the code:

      <h:form>
       <a4j:commandLink value="show"
       oncomplete="Richfaces.showModalPanel('mp')" reRender="mp" />
      
      </h:form>
      <rich:modalPanel id="mp" minHeight="200" minWidth="450" height="200"
       width="500" zindex="2000">
       <f:facet name="header">
       <h:outputText value="Modal Panel Title" />
       </f:facet>
       My Modalpanel
      </rich:modalPanel>
      



      As I said, this only happens when reRedner is set to "mp". Otherwhise the panel show up, but how can I populate changes gthen with only one click? using the onstop attribute from an <a4j:status> ? I would love to get it work as I showed in the snippet.

      Can sw. help?

      Thanks

        • 1. Re: reRender blocks oncomplete call with Modalpanel (bug?)

          Hm, I really would like to know if this is a bug or a technical restriction?

          Hey developers, a short statement would be enough! I really tried this out a whole day, and an answer would be really nice!

          I claim that what ilya_shaikovsky said in thread:
          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=117790
          does not work...

          Meaning that reRendering a modal panel or a component that contains the modal panel and showing it afterwards via oncomplete in the same action won't work. Is that true?
          [/url]

          • 2. Re: reRender blocks oncomplete call with Modalpanel (bug?)

            Try to reRender not the modal panel itself but the content of the modalPanel.

            • 3. Re: reRender blocks oncomplete call with Modalpanel (bug?)
              mail.micke

              Hi

              You shouldn't reRender the actual modal panel, instead you should reRende its content.
              Try wrapping the content in a a4j:outputPanel and re render that, it works for me.

              Can't comment on rerendeing a component which wrapps the entire panel, haven't tried that.

              Cheers

              • 4. Re: reRender blocks oncomplete call with Modalpanel (bug?)

                Hi,

                at first I want to thank you for the replies. Rerendering the content of the modal panel is a possible solution. But it only makes sense when you create the modal panel via a tag on the page. What I tried was to dynamically create it. ThereforeI need to rerender the whole panel or the parent element, that contains it. It is like the example that ilya posted.

                It looks like it does not work this way, so what I do right now is to dynamically create the a4j:panel inside the panel and have the modal panel itself rendered via the page tag. I'm not satisfied with this solution because I cant change the header dynamically for example.

                If sw. has to meet the same requirement to create and show a panel completely dynamically I would appretiate any coments on how this can be done...

                Cheers

                • 5. Re: reRender blocks oncomplete call with Modalpanel (bug?)
                  mail.micke

                  I see, you are using a binding for your modal panel.

                  When I get back to work on Monday I'll see if I can't try to reRender a component which wraps a modal panel. To see if it works when not using a binding.

                  When dynamically creating the modal panel; can't you create the a4j:outputPanel dynamically as the modal panel content and assign it an id that you use when rerendering.
                  Same goes for the header .

                  Then use those two ids when rerendering. Not a pretty solution I know but it might work ;)

                  Cheers

                  • 6. Re: reRender blocks oncomplete call with Modalpanel (bug?)

                    Hi,

                    in fact I do create a dynamic a4j:outputPanel, but I directly bind it to the component on the page:

                    <rich:modalPanel id="mp" height="200" width="400" zindex="2000"
                     resizeable="false" moveable="false">
                     <f:facet name="header">
                     <h:outputText value="Modal Panel Title" />
                     </f:facet>
                     <f:facet name="controls">
                     <h:graphicImage value="/img/close.gif" style="cursor:pointer"
                     onclick="Richfaces.hideModalPanel('mp')" />
                     </f:facet>
                     <a4j:outputPanel binding="#{eventBean.mpContent}" id="mp_content" />
                     </rich:modalPanel>
                    


                    This way I am not able to dynamically change the header. I could also bind the facets but as you said it's not that straight ;-)

                    I already tried both: creating a modal panel dynamically and creating it via the page tag (like this first example I posted in this thread) and both did not work as soon as I reRender the panel itself or the parent component. You could try the code snippet in my first post here and tell me if you got it running if you have time :)

                    Cheers and thanks

                    • 7. Re: reRender blocks oncomplete call with Modalpanel (bug?)
                      mail.micke

                      Hi

                      I just tested adding a

                      <a4j:outputPanel id="mpWrapper">


                      around a modal panel, and it worked for me.

                      Try adding a a4j:log to your page and see what happens with the request.

                      Good luck,
                      Micke