4 Replies Latest reply on Jan 23, 2009 11:51 AM by Francois Eric

    TabPanel closes ModalPanel

    Francois Eric Novice

      Hello,

      When I open a ModalPanel which contains a TabPanel, when switching tabs, the ModalPanel closes.

      Here is an example:

       <a4j:outputPanel ajaxRendered="true">
       <h:form id="product-edit-form">
       <a4j:commandLink action="Modal" oncomplete="Richfaces.showModalPanel('panel-modal',{width:550, top:200});" immediate="true">
       <img src="/totaltest/static/img/new.png"/>
       </a4j:commandLink>
       <rich:modalPanel id="panel-modal">
       <rich:tabPanel switchType="ajax" id="panel2">
       <rich:tab label="tab1.1" immediate="true" >
       tab1.1
       </rich:tab>
       <rich:tab label="tab1.2" immediate="true" >
       tab1.2
       </rich:tab>
       </rich:tabPanel>
       </rich:modalPanel>
       </h:form>
       </a4j:outputPanel>
      


      Any idea why?

      Thank you,

      Francois

        • 1. Re: TabPanel closes ModalPanel
          Nick Belaevski Master

          Hello Francois,

          rich:modalPanel is closed because it is inside a4j:outputPanel having ajaxRendered="true".

          • 2. Re: TabPanel closes ModalPanel
            Francois Eric Novice

            Great! Thanks a lot that indeed fixed my example.

            One little more thing:

            I've got to say I'm a little confused with the use of a4j:outputPanel. In my application page (you'll notice that I simplified it here for this post) I remember needing the outputPanel to be able to get my fields updated... I read the doc:

            Creates an AJAX-enabled part of the page. For a normal request, render a <span> or <div> HTML element depending on the value of the "layout" attribute, "inline" or "block". (The "id" attribute will be the value of the clientId property.) For an AJAX request, the content of this element is included in the response if the value of the property, "ajaxRendered", is set to true.


            But still don't grasp its purpose. Could someone please explain exactly what its for?

            THank you very much for your help

            • 3. Re: TabPanel closes ModalPanel
              Ilya Shaikovsky Master

              you could reRedner parts of the pages in a next ways:

              <a4j:outputPanel ajaxRendered="#{bean.autoRendered}" id="out">
              ...some fields there
              <h:outputText id="result" .../>
              ...some fields there
              </a4j:outputPanel>
              
              <a4j:commandLink reRender="#{bean.toRender}>
              


              1) Concrete elements update.
              autoRendered=false, toRender='result'

              just outputText will be updated.

              2) Some part of the page update.
              autoRendered=false, toRender='out'

              whole outputPanel with its children updated.

              3) Automatically updated area
              autoRendered=true toRender=""

              the panel updated automatically without specifying in reRender from any ajax request on the page.(excluding renderRegionOnly marked regions)


              • 4. Re: TabPanel closes ModalPanel
                Francois Eric Novice

                excellent!

                Thank you for the clarification