10 Replies Latest reply on Nov 27, 2009 7:28 AM by Ilya Shaikovsky

    a4j:region renderRegionOnly

    Nicolas Gaudin Newbie


      Is the default renderRegionOnly set to true or false.?

      There is inconsistent info in documentation:
      - in description it says default is false
      - in key attributes and ways of usage :

      The processing could be also accelerated if a region decoded for the processing passes straight
      away into Encode. But to update some data out of the region or on another region, use the
      "renderRegionOnly" attribute set to "false" ("true" on default) to change this behaviour.

      So what is the correct one?

      More, I have really weird behaviour (RF 3.3.0GA) with a4j:region.

      My page architecture is as follows:
      - the main page 'MAIN' polling for session check
      - a a4j:include in 'MAIN' called 'EXPLORER'
      - two a4j:include in 'EXPLORER' called 'TREE' (form with rich:tree) and 'LIST' (form with rich:extendedDataTable)

      Weird behaviour of a4j:region:
      1srt case:
      TREE include contains a rich:tree in h:form. the tree uses several a4j:support for onclick, DnD, deletion of treeNode via contextmenu,etc..

      When clicking on a treeNode, the 'LIST' include gets actually and visually rerendered by reRender attributes of a4j:support for onclick event.
      This is working fine without any region, EXCEPT that the 'LIST' include gets also rerendered (not visually but in the log) for all ajax request sent by others a4j:support (event ondrag for instance)

      ==> SO, Just for checking because I do not want to do that as I need to actually rerender the LIST include after node click but anyway:
      I added an a4j:region (renderRegionOnly=TRUE) around the rich:Tree, BUT same result: the extended data table gets rerendered at each ajax Request sent by an a4j:support ???

      2nd case: Polling to check session in main page
      i have a a4j:poll encapsulated in h:form and a4j:region (in this order: <h:form><a4j:region><a4j:poll>...) with renderRegionOnly forced to true at he beginning of 'MAIN' page.

      ==> When poll is triggered, I get the rich:tree in TREE include of EXPLORER that gets rerendered (not visually, but in the log)... but not the extendedDataTable contained in LIST include of EXPLORER include...

      I also tried removing all a4j:includes and putting all in same page...same results..

      I originally thought the problem of this weird behaviour of a4:region was coming from extendedData table and particularly tableState management)...
      but with this 2nd case.....I am getting completly lost here..
      Could anyone explain to me why all this happens?
      This is critical for the performance of my application that I can limit the regions

      Sincerely hope somebody ca help me on this as I am becoming crazy..

      Best regards to all,

        • 1. Re: a4j:region renderRegionOnly HELP PLEASE
          Nicolas Gaudin Newbie


          Could anyone answer or help me on this.

          Is my issue well defined? Am i not clear in my description
          Should I write another post (less detailed maybe)

          Many thanks in advance

          • 2. Re: a4j:region renderRegionOnly
            Thomas W Newbie

            a4j:repeat, dataTable, extendedDataTable all have the same problem. During JSF lifecycle the underlying datamodel is accessed

            SequenceDataModel.isRowAvailable() line: 171
            HtmlAjaxRepeat(UIDataAdaptor).isRowAvailable() line: 266
            HtmlAjaxRepeat(UIDataAdaptor).setRowKey(FacesContext, Object) line: 341
            HtmlAjaxRepeat(UIDataAdaptor).iterate(FacesContext, UIDataAdaptor$ComponentVisitor, Object) line: 1034
            HtmlAjaxRepeat(UIDataAdaptor).encodeAjaxChild(FacesContext, String, Set, Set) line: 496
            AjaxRegionRenderer(AjaxChildrenRenderer).encodeAjaxComponent(FacesContext, UIComponent, String, Set, Set) line: 104
            AjaxRegionRenderer(AjaxChildrenRenderer).encodeAjaxChildren(FacesContext, UIComponent, String, Set, Set) line: 67

            Due to that even an attempt to make the data model bean lazy initialize does not help.

            Interestingly the same is not true for child elements, in below example the echo2 method will not be called, even though testBean.rows is called and returns multiple entries:

            <a4j:repeat id="detail" value="#{testBean.rows}" var="attr">
            <h:outputText value="#{testBean.echo2()}"/>

            Is there any workaround for this or at least perhaps a pointer from the RF team where to look for it?

            • 3. Re: a4j:region renderRegionOnly
              Richard Taylor Newbie

              I'm running into what I believe to be the same issue. I've tried to simplify it as much as possible. I'm new to RichFaces so it may be a lack of understanding, but I've read "Practical RichFaces" and all the docs I can find, still can't figure it out.

              I'm also have a <a4j:poll/> on my page and am trying to update some components but not others. What I'm finding is that my dataTable always get encoded on the server side even if its id was not specified in the "reRender" attribute and with limitToList set to true (sounds like repeat, and others would do the same thing).

              Here is my basic page:

              <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
              <ui:composition xmlns="http://www.w3.org/1999/xhtml"
               xmlns:a="http://richfaces.org/a4j" template="/layout/frame.xhtml">
               <ui:define name="body">
               <a:poll id="poller" interval="5000" reRender="poller,time1,time2" limitToList="true"
               enabled="#{document.distribution.reporting.distributionReport.autoUpdate}" />
               <a:outputPanel ajaxRendered="true">
               <h:messages />
               <h:outputText id="time1"
               <s:convertDateTime type="both" />
               <h:outputText id="time2"
               <s:convertDateTime type="both" />
               <br />
               <rich:dataTable id="dataTable"
               var="a" rows="10">
               <f:facet name="header">Data</f:facet>
               <h:outputText value="#{a}" />

              Here are the relevant methods on my bean

               public Calendar getTime() {
               return Calendar.getInstance();
               public List<String> getBasicData() {
               List<String> data = new ArrayList<String>();
               return data;

              Here is my log4j output
              11:00:24,247 DEBUG [com.foo.testBean] (ajp- Message:getTime()
              11:00:24,250 DEBUG [com.foo.testBean] (ajp- Message:getTime()
              11:00:24,258 DEBUG [com.foo.testBean] (ajp- Message:getBasicData()

              What I find is that while the data table is (correctly) not updated on the page after polling, there is still a call to getBasicData() on the server side.

              I stepped through the code and I suspect it has to do with regions.

              The ONLY way I can get around this is to put the <a4j:poll> inside a region with the components I'd like to update AND set renderRegionOnly="true". That works, however, I'm trying to have one poller that updates various parts of the page (i.e. TabPanel) so I can't easily bundle the poller in the same region and set renderRegionOnly

              So what "tw" says about the data model still being accessed is true, the datatable component is still being "encoded" on the server side.

              Can anyone give us a clue as to why? Is it because the implicit top level a4j:region is being encoded and hence everything underneath it as well?

              Nicog, I'm finding that answer to be "false" by the way for a default value on renderRegionOnly.

              Seam 2.1.2, RichFaces 3.3.0

              • 4. Re: a4j:region renderRegionOnly
                Daniel Yang Novice

                Hi, RichardTaylor
                Maybe you shoud use a4j:poll like this:
                <a4j:poll id="poller" ajaxSingle="true" interval="5000" reRender="time1,time2" limitToList="true"/>
                You see the attribute ajaxSingle="true"?
                May be the defualt value of the attribute is false, so the whole page is refreshed, if you set it true and set limitToList="true", only the ids you defined in reRender will be encode in sever side.

                • 5. Re: a4j:region renderRegionOnly
                  Geza Takach Newbie

                  I use

                   <rich:tree id="tree" style="width: 980px;" switchType="client" adviseNodeOpened="#{treeSettings.adviseNodesOpened}">
                   <rich:treeNodesAdaptor id="product" nodes="#{calculation.product}" var="product">
                   <rich:simpleTogglePanel switchType="client" label="Product[ID:#{product.productID}]" opened="#{treeSettings.leavesOpened}">

                  and inside these simpleTogglePanel I try to use a4j:commandLink or a4j:support to reRender only some specified components.

                  I tried all possibilities you wrote here. None of them works. If I use
                  a4j:region with renderRegionOnly="true" then nothing will be re-rendered, allthough the value submission is done.

                  Any ideas?

                  • 7. Re: a4j:region renderRegionOnly
                    Geza Takach Newbie

                    Thank you for your help.

                    The solution was that (using still a4j:region with renderRegionOnly="true") I had to put the components to re-render into an

                    <a4j:outputPanel ajaxRendered="true" id="op">

                    and specify "op" in the reRender parameter of the commandLink.

                    • 8. Re: a4j:region renderRegionOnly
                      Geza Takach Newbie

                      Unfortunately, I lost the possibility to toggle my simpeTogglePanel. I will downgrae to plain panels.

                      • 9. Re: a4j:region renderRegionOnly
                        Geza Takach Newbie

                        Sorry, that was a mistake, I can toggle the panels without problem.

                        "takach" wrote:
                        Unfortunately, I lost the possibility to toggle my simpeTogglePanel. I will downgrae to plain panels.

                        The more paintfull thing is the constraint closing the components into a common region that makes impossible to keep my h:panelGrid layout.

                        • 10. Re: a4j:region renderRegionOnly
                          Ilya Shaikovsky Master

                          b.t.w. limittolist could be used at ajax components instead of a4j:region around them.