How to exclude child component in ajax update of a parent component?
If you're using at least PrimeFaces 3.3, then you can use PrimeFaces Selectors for this. This allows you using jQuery CSS selector syntax in process
and update
attributes of PrimeFaces ajax components.
For example:
<h:form>
<h:inputText ... />
<h:inputText ... />
<h:inputText ... styleClass="noupdate" />
<h:inputText ... />
<h:inputText ... />
<p:commandButton ... update="@(form :not(.noupdate))"/>
</h:form>
This example will update the entire form except for inputs having class="noupdate"
in the client side.
If you want to update a all children of a certain component except one, replace 'form' by the id of the surrounding component (or a class or...)
<h:form id="form">
<h:panel id="myPanel">
<h:inputText ... />
<h:inputText ... />
<h:inputText ... styleClass="noupdate" />
</h:panel>
<h:inputText ... />
<h:inputText ... />
<p:commandButton ... update="@(form :not(.noupdate))"/>
</h:form>
<p:commandButton ... update="@(#form\:myPanel :not(.noupdate))"/>
Just make sure you use the full client-side id.
See also:
- How do PrimeFaces Selectors as in update="@(.myClass)" work?