5 Replies Latest reply on Jan 21, 2010 2:08 PM by rafaelk

    Best way of rendering a panel

    rafaelk

      Hello there!

       

      I have a rich:panel and inside this panel, a rich:dataTable and 2 buttons: one to clear the dataTable results and other to generating new ones.

      I want to reRender the panel after both requests (generating new results, clearing results) without refreshing the page.

      My question is about the way of reRendering this panel, wich components do I need to use to make it in the best way?

       

      Any hint helps!

       

       

      Thanks

        • 1. Re: Best way of rendering a panel
          lmk

          Hi,

           

          you could use reRender attribute  available on ajax components , here an example for commandButton, you could also use a4j:support inside  JSF compoents.

           

          <a4j:commandButton reRender="panelId" action="#{managedBean.clearDatas}" />
          • 2. Re: Best way of rendering a panel
            rafaelk

            I've tried that, but it not worked.

             

            To this kind of request, what tag do I need to use? <a4j:region> or <a4j:outputPanel> ?

             

            My code looks like this:

             

                <a:form>
                        <rich:panel id="flx-panel">
                   
                        <h:outputText value="#{messages['flx']}"
                                   rendered="#{empty flx.resultList}"/>
                   
                        <rich:dataTable id="flx-dataTable"
                                    var="_flx"
                                  value="#{flxList.resultList}"
                               rendered="#{not empty flxList.resultList}">
                            <rich:column>
                             ... </rich:column>
                             <rich:column>
                             ... </rich:column>
                             <rich:column>
                             ... </rich:column>
                        </rich:dataTable>       
                               
                        <s:div styleClass="actionButtons">

                            <a:commandButton
                                id="calculate-flx"
                                action="#{myBean.calculateFlx}"
                                value="#{messages['common.calculate']} #{messages['flx']}"
                                reRender="flx-panel"/>
                          
                            <a:commandButton
                                id="clean-flx"
                                action="#{myBean.cleanFlx}"
                                value="#{messages['common.delete']} #{messages['flx']}"
                                reRender="flx-panel"/>                                                       
                           
                        </s:div>
                        </rich:panel>
                   </a:form>


            • 3. Re: Best way of rendering a panel
              csimons

              You should try using the a4j:outputPanel as the *target* of your "reRender".

               

              a4j:regions, best to my knowledge, are used to contain a4j requests within a single container so that they do not propagate to other regions/parts of the page.

               

              Hope this helps.

              1 of 1 people found this helpful
              • 4. Re: Best way of rendering a panel
                lmk

                you can use any panel,even a h:panelGroup.

                you can also a4j:outputPanel with ajaxRendered, so, ou do not need to use  reRender

                1 of 1 people found this helpful
                • 5. Re: Best way of rendering a panel
                  rafaelk

                  Thanks, for both.

                   

                  I used the output panel as target of my button and it worked.

                  I always got confusion between ajaxSingle and ajaxRendered parameters