I am using PrimeFaces <p:ajax>
tag in my code. How we can exclude a child component from getting updated in an ajax call that update 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With