JSF2: Re-render all components on page that have a given ID, without absolute paths
Posted
by
tlind
on Stack Overflow
See other posts from Stack Overflow
or by tlind
Published on 2010-12-26T17:08:17Z
Indexed on
2010/12/26
23:54 UTC
Read the original article
Hit count: 203
Is there any way in JSF 2.0/PrimeFaces of re-rendering all components (using the PrimeFaces update="id1 id2..."
attribute or the <f:ajax render="..."/>
tag) that have got a given ID, regardless of whether they are in the same form that contains the button triggering the AJAX re-render or not?
For example, I want my button to re-render all sections on a page that visualize the user's current shopping basket.
Right now, I always have to specify the absolute path to the components that I want to get updated, e.g.
update=":header:basket :left-sidebar:menu:basket"
which is rather impractical if the structure of the page changes (besides, I have not been able to figure out the correct path for one of these components). I already tried to implement a custom EL function like this, which traverses the component tree:
update="{utilBean.findAllComponentsMatchingId('basket')}"
but at the time that function is evaluated, apparently not the entire component tree has been set up as it doesn't contain the components I am looking for.
How can I deal with this? There certainly must be an easy way of doing AJAX-based updates of sections of the page that are not part of the current <h:form>
?
Thanks!
© Stack Overflow or respective owner