1 2 Previous Next 19 Replies Latest reply on Jul 14, 2008 10:59 PM by jpount

    reRender from modal panel

    lucab

      let's say i have a page like this:

      <f:view>
       <h:form id="the_big_form">
       <any:component id="foo" />
       <another:component id="bar" />
       <evenmore:component id="baz" />
       ...
       </h:form>
       <!-- bottom area where i place the includes for the modal panel -->
       <rich:modalPanel id="my_modal_panel">
       <h:form id="panel_form">
       <!-- pay attention to this component -->
       <a4j:commandButton action="some action" reRender="foo,bar,baz" "other_attributes_as_needed" />
       </h:form>
       </rich:modalPanel>
       <!-- end of bottom area -->
      </f:view>
      


      this code won't work. What is the correct way to reRender one or more components from a modal panel when the components to reRender do not belong to the modal panel (but live on the same page, just in another form)?
      I tried fully qualifying the components from the modal panel (that is, bigger_form:foo for example). This approach does not work too.

      thanks :)

        • 1. Re: reRender from modal panel
          eklam

          Hi,

          Got the same issue...

          Any workaround?

          Thanks

          • 2. Re: reRender from modal panel

            Hi guys,

            I got the same problem too and it's been several days that I'm desperatly looking for a solution.
            Actually, I'm able to update the bean value but the page that is under the modal panel is not rerender.

            My aim is simple, I would like to:
            - open a modal panel displaying a list of values as links,
            - choose a link, this close the modal panel and rerender a field of the page.

            I would be very happy to have this working cause I defenitely needs this.

            Thanks for your help.

            • 3. Re: reRender from modal panel

              Ever tried the_big_form:foo?

              • 4. Re: reRender from modal panel
                ilya_shaikovsky

                could you pelase check a4j:log in order to check client side reRendering problems? I've created similar test some time ago for another case.. and such reRendering was fine there.

                • 5. Re: reRender from modal panel
                  jonckvanderkogel

                   

                  What is the correct way to reRender one or more components from a modal panel when the components to reRender do not belong to the modal panel (but live on the same page, just in another form)?


                  The trick is to wrap your modalPanel in an a4j:region with renderRegionOnly="false". Like this:
                  <a4j:region renderRegionOnly="false">
                   <rich:modalPanel>
                   .....
                   </rich:modalPanel>
                  </a4j:region>
                  


                  • 6. Re: reRender from modal panel
                    lucab

                    documentation says renderRegionOnly=false is the default, so i tried to surround the modal panel with an ajax region as you suggested but reRender still is a dream. :(

                    • 7. Re: reRender from modal panel
                      eklam

                      I have the same issue and the ajax region also didnt work

                      • 8. Re: reRender from modal panel
                        lmk

                        how do you include modalPanel on jsf page..?

                        you have just to include modalPanel outside the page form.it works fine for both RF 3.1 and 3.2 .


                        • 9. Re: reRender from modal panel
                          eklam

                          My modalPanel is within an a4j:form, otherwise modalPanel is not rendered...

                          • 10. Re: reRender from modal panel
                            fabmars

                            I see Serguy coming and telling you to read the notes on the ModalPanel dev guie :)

                            • 12. Re: reRender from modal panel
                              pinaev

                              Has anyone figured it out?
                              I am having the exact same issue, though the modal panel of mine is not included within a form.
                              The outer form however is an "a4j:form" with the "ajaxSubmit" attribute set to "true".
                              Thoughts and suggestions would be mich appreciated!

                              • 13. Re: reRender from modal panel

                                Hi guys,

                                I found a solution for my problem, but as usual, it pointed out other problems with dataScroller, it is never the end...

                                Anyway, this works for a simple use.

                                To reRender a field in the main page, from a Modal Panel, just use the a4j:actionParameter tag. It allows to set a bean field value using ajax.

                                in the main page I would have :

                                ...
                                <h:outputText value="#{myBean.myFieldToUpdate}" />
                                ...
                                <rich:modalPanel ...>
                                
                                <h:commandLink value="someValue" >
                                 <a4j:actionparam name="paramName" value="myNewValue" assignTo="#{myBean.myFieldToUpdate}"/>
                                </h:commandLink>
                                
                                </rich:modalPanel>
                                


                                This will update the bean field value without refreshing the whole page, just by rerendering the <h:outputText /> tag.

                                The <a4j:actionParam> tag is very useful as you don't have to write any code in your bean to update the field.

                                Hope it will help somebody.

                                You can find examples in the RichFaces Live Demo, it's the first example: "Action Parameter".

                                The problem now is that it is not working correctly with dataScroller. All the links that are in the first page of the dataScroller update the field, but when I go to the second page, the links are not working anymore and nothing happens...

                                Anyway thanks for your help.

                                • 14. Re: reRender from modal panel
                                  lucab

                                   

                                  "lmk" wrote:
                                  how do you include modalPanel on jsf page..?

                                  you have just to include modalPanel outside the page form.it works fine for both RF 3.1 and 3.2 .


                                  i include my modal panel this way
                                  <a4j:include id="bp_cnt-panel" viewId="modals/contactlist.xhtml" />
                                  


                                  which points to
                                  <rich:modalPanel id="addAddressPanel" autosized="true" minWidth="600">
                                   <f:facet name="header">
                                   <h:panelGroup>
                                   <h:outputFormat value="#{msg.addAddress}" />
                                   </h:panelGroup>
                                   </f:facet>
                                   <f:facet name="controls">
                                   <h:panelGroup>
                                   <a4j:commandLink reRender="_address_tab" onclick="Richfaces.hideModalPanel('addAddressPanel');">
                                   <h:graphicImage value="/resources/images/Close.png" style="width:16px; height:16px; cursor:pointer" id="hidelink3" />
                                   </a4j:commandLink>
                                   </h:panelGroup>
                                   </f:facet>
                                   <h:form id="addaddress-form">
                                   <a4j:include id="addaddress-view" viewId="#{addressNavigation.viewId}"/>
                                   </h:form>
                                   </rich:modalPanel>
                                  

                                  modal panel is surrounded with an f:subview, is that a problem??

                                  @kins57:
                                  I can't adopt your solution beacause i have to reRender a table with a datascroller. So if you say your solutions cause confilcts for my particular case that is not a solution at all.

                                  @febmars:
                                  I don't think sergey will complain about this topic. i'm doing things correctly as explained in the documents.

                                  regards

                                  1 2 Previous Next