Absolute reRendering using RichFaces

Posted by wheelie on Stack Overflow See other posts from Stack Overflow or by wheelie
Published on 2010-01-28T13:55:03Z Indexed on 2010/05/22 10:20 UTC
Read the original article Hit count: 412

Filed under:
|
|

Hey there,

I am implementing copy/paste functionality for a complex object tree, this means you can copy an object and paste it where the object type is the same. Therefore I need to reRender the <a4j:commandLink>-s which are performing the paste action (so it will show on the GUI or not).

Simplified example:

Problem is that copy links are deep in the tree. How is it possible to reRender on a higher level in the component tree?

(very)Simplified example:

...
<h:form id="form1">
...
<a4j:commandLink value="Copy" reRender=":paste1, :paste2, :paste3" />
<a4j:commandLink id="paste1" value="Paste" rendered="#{myBean.myHashMap.key}" />

<a4j:outputPanel>
     <a4j:region renderRegionOnly="true">
         <a4j:commandLink value="Copy" reRender=":paste1, :paste2, :paste3" />
         <a4j:commandLink id="paste2" value="Paste" rendered="#{myBean.myHashMap.key}" />
     </a4j:region>
     <a4j:outputPanel>
          <a4j:region renderRegionOnly="true">
               <a4j:commandLink value="Copy" reRender=":paste1, :paste2, :paste3" />
               <a4j:commandLink id="paste3" value="Paste" rendered="#{myBean.myHashMap.key}" />
          </a4j:region>
     </a4j:outputPanel>
</a4j:outputPanel>
...
</h:form>

Something like that. In practise this differs in that a rich:tree is displayed. Also, there can be multiple instances of the same paste link: object:0::paste3, object:1::paste3.

private final String pasteIDs = ":xxPaste, ... , :xyPaste";

According to the RichFaces reference, putting the separator to the beginning of the ID means it is an "absolute" search expression, however this way i get the same result: only the 'local' paste link gets rerendered, the others not.

Every copy-paste link pair is encapsulated in <a4j:region renderRegionOnly="true">, because it is necessary for other components to restrict the reRender to that region. Could this be blocking the reRender I want to make?

Also I want to rerender exactly those paste links, so no other rerender action is triggered. Hope it is clear what i want to achieve.

Any help would be appreciated! Daniel

© Stack Overflow or respective owner

Related posts about jsf

Related posts about richfaces