Absolute reRendering using RichFaces

和自甴很熟 提交于 2019-12-03 08:57:29
  • reRender works with providing an the id of the target object you want to reRender (inside the same naming container - form most often)
  • the id should be a unique string, according to html spec
  • reRender allows dynamic value - i.e. reRender="#{myBean.currentItemsToRerender}

Based on that I think you should be able to achieve what you want (although it's not entirely clear)

Update:

UIComponent.findComponent(..) has a well-defined algorithm for resolving ids. So for absolute referencing your reRendered id should start with : and then continue through the hierarchy of the naming containers.

Daniel Szalay

Here is an example where changePanel111() changes the content of a lower element:

<h:form id="form" prependId="true">
    <rich:panel id="PANEL1">
        <h:outputText id="PANEL1TEXT" value="#{ajaxTestBean.panel1}"/>
        <rich:panel id="PANEL11">
            <h:outputText id="PANEL11TEXT" value="#{ajaxTestBean.panel11}"/>
            <rich:panel id="PANEL111">
                <h:outputText id="PANEL111TEXT" value="#{ajaxTestBean.panel111}"/>
            </rich:panel>
        </rich:panel>
        <rich:panel id="PANEL12">
            <h:outputText id="PANEL12TEXT" value="#{ajaxTestBean.panel12}"/>
            <br/>
            <a4j:commandLink value="CHANGE PANEL12" action="#{ajaxTestBean.changePanel12}">
                <a4j:support reRender="PANEL12" event="onclick"/>
            </a4j:commandLink>
            <br/>
            <a4j:commandLink value="CHANGE PANEL111" action="#{ajaxTestBean.changePanel111}">
                <a4j:support reRender="form:PANEL111" event="onclick"/>
            </a4j:commandLink>
        </rich:panel>
    </rich:panel>
</h:form>

Notice how the lower element needs to be identified as form:PANEL111.

Hope this helps!

reRender can point to any component outside the form as well. For example this works:

<h:form>
  <a4j:commandButton reRender="panel"/>
</h:form>

<h:panelGrid id="panel">
...
</h:panelGrid>
Arsal

For my MyFaces+Richfaces App, <rich:panel> tag was not working as described in the selected answer. When I changed it to <a4j:outputPanel ajaxRendered="true" />, it started working as given here "<a4j:commandLink> Not Rerendering"

Configuration: MyFaces 2.1.10(Facelets used for templating) and Richfaces 4.2.3.

Hope this will help.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!