1

I'm using a PrimeFaces commandButton to issue an Ajax request.
I should set the update attribute so that the whole parent form be updated EXCEPT for some specific components (Let's say I've tagged them with styleClass="noupdate").
I'm using PrimeFaces 3.5, so I think PrimeFaces JQuery Selectors may help.
I tried something like this:

<!-- ...some inputs/labels to be updated here... -->
<p:overlayPanel styleClass="noupdate">
    <!-- ...some inputs/labels to be updated here... -->
    <p:commandButton id="btnDoIt" value="Do it" 
            update="@(this.closest('form') :not(.noupdate))"/>  
</p:overlayPanel>

but it doesn't work (I get a JavaScript Syntax Error).
Is there a way to get what I need?
Notice that:
1) The form id is not known because the button is part of a composite component that can be hosted by any form in different views
2) In my example the <p:overlayPanel> itself must not be updated, but any descendant component do.
3) There are more than one form in the view, and I should work on the "current" one only.

Thank you in advance to anyone can help me.

yankee
  • 509
  • 2
  • 9
  • 18

1 Answers1

3

There's no such thing as this in PrimeFaces selectors. There are definitely no jQuery functions like $.closest() available in PrimeFaces selectors. It has just to be a pure jQuery-compatible CSS selector, not some JavaScript code.

<p:commandButton ... update="@(form :not(.noupdate))"/>

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Ok, thank you. So, can we definitely say that there is no way to limit the context of PFS to the "current" form? – yankee Apr 03 '13 at 15:13
  • Oh right, sorry, I now see the point of your question; you've multiple forms and this will of course not work as intented at all. I did some quick experiments with `form:eq(1)` and `[id='#{form.clientId}']` but that didn't seem to work at all. I will look closer at PrimeFaces source if the time allows it. In the meanwhile, please unaccept this answer as it didn't actually answer the question. – BalusC Apr 03 '13 at 15:50
  • I ran into this issue to find a workaround for [this](http://stackoverflow.com/questions/15656856/primefaces-dynamic-overlaypanel-showing-only-once) other problem - don't know if you had time for that too. Anyway, thank you so much, I Always learn a lot of things. – yankee Apr 04 '13 at 08:44