0

I got a form, that includes outputPanel that I need to update, excluding one of its component (it containts calendar, that resets after I call update, I want to prevent that)

<p:ajax update=":form1:outputPanel1 :not(form1:outputPanel1:nestedOutputPanel)"/>

But I have no idea how can I achieve something like this (above example is not working)?

user9309329
  • 313
  • 3
  • 13
  • Possible duplicate of [How do PrimeFaces Selectors as in update="@(.myClass)" work?](https://stackoverflow.com/questions/20080861/how-do-primefaces-selectors-as-in-update-myclass-work) – Kukeltje Mar 02 '18 at 11:57
  • Carefully read the PrimeFaces documentation and showcase. It's all in there... – Kukeltje Mar 02 '18 at 11:59

1 Answers1

4

The PrimeFaces update attribute takes one or more expressions separated by a space (or comma). Normally (in plain JSF) those expressions are client IDs, but in PrimeFaces you can also use selectors. A selector is executed and results in a list of client IDs to update. You could use a selector to select all the components that need to be updated and exclude the component you don't want to update.

You could add a style class to the component you want to exclude and use something like:

update="@(.parent :not(.exclude))"

As you can read in the top answer on the linked question, the @(...) selector will be used as a jQuery selector. So you can easily test selectors in your browser's JavaScript console as $("...").

See also:

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102