7 Replies Latest reply on Jun 23, 2009 6:52 AM by Ilya Shaikovsky

    Rerender html tags

    Dianne Ravi Newbie

      Is it possible to rerender standard html tags nested inside an a4j:region tag?

       <rich:calendar value="#{user.date}">
       <a4j:support event="onchanged" action="#{user.dateUpdated}" reRender="standard_html" />
       </rich:calendar>
       <a4j:region id="standard_html">
       <div><h:outputText value="#{user.date}" /></div>
       </a4j:region>
      

      The code above has a simple div tag with a single h:outputText but the actual code is longer and has many components. I know that I can set an id on the h:outputText to get it rerendered but doing so means I need to do this for all the components in the page.

        • 1. Re: Rerender html tags
          Ilya Shaikovsky Master

           

          <a4j:command reRender="toReRender"/>
          
          <a4j:outputPanel id="toReRender" layout="block">
           ....content to be ReRendered
          </a4j:outputPanel>


          • 2. Re: Rerender html tags
            Dianne Ravi Newbie

            Thanks Ilya, your suggestion worked :)
            Now I am trying to perform a conditional rerendering using the rerender attribute on the a4j:outputPanel

            <a4j:command reRender="toReRender"/>
            
            <a4j:outputPanel id="toReRender" layout="block" rerender="#{not empty list}">
             ....content to be ReRendered
            </a4j:outputPanel>
            

            However, adding the condition caused the a4j:outputPanel to stop getting rendered after the a4j:command. Is there a work around?

            • 3. Re: Rerender html tags
              panky_p Novice

              use rendered instead of rerender

              <a4j:outputPanel id="toReRender" layout="block" rendered="#{not empty list}">
              


              • 4. Re: Rerender html tags
                Ilya Shaikovsky Master

                and do not reRender conditionally rendered elements directly. Some parent should be reREndered instead.

                • 5. Re: Rerender html tags
                  Dianne Ravi Newbie

                   

                  "panky_p" wrote:
                  use rendered instead of rerender
                  <a4j:outputPanel id="toReRender" layout="block" rendered="#{not empty list}">
                  

                  Sorry, that was a typo as a4j:outputPanel does not have a rerender attribute.

                  "ilya_shaikovsky" wrote:

                  and do not reRender conditionally rendered elements directly. Some parent should be reREndered instead.

                  The following works as you suggested. However, I had to use two a4j:outputPanel tags. Is there another way of doing this?
                  <a4j:command reRender="toReRender"/>
                  
                  <a4j:outputPanel id="toReRender" layout="block">
                  <a4j:outputPanel rendered="#{not empty list}">
                   ....content to be ReRendered
                  </a4j:outputPanel>
                  </a4j:outputPanel>
                  
                  


                  • 6. Re: Rerender html tags
                    Ilya Shaikovsky Master

                    This limitation comes from the fact that we can't know where you need to insert new element if it not exist in DOM tree before.

                    B.t.w. read more about outputPanel more. To avoid two panels - one with "none" layout could be used.

                    • 7. Re: Rerender html tags
                      Ilya Shaikovsky Master

                      but in the case with none layout rendered conditions should be on elements inside that panel and reRender should be pointed to inner content. So it seems that you willl have the same nesting structure.