1

Is it possible to update any html fragment using Primefaces selectors - PFS? Consider this:

<h:outputText id="test" value="#{testBean.date}"/>
<span id="test2"><h:outputText value="#{testBean.date}"/></span>

<p:commandButton value="test" process="@none" update="@(#test)"/>
<p:commandButton value="test2" process="@none" update="@(#test2)"/>

Only first button is refreshing. It's trival example - my real need is to update some parts of datatable, without refreshing whole component.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
karolkpl
  • 2,189
  • 10
  • 39
  • 60

1 Answers1

3

No, that's not possible. The update target must not only in client side be obtainable in HTML DOM tree by document.getElementById(), but also in server side by UIViewRoot#findComponent(), so that JSF can regenerate the desired HTML output which ultimately get applied during the ajax update.

If you supply JSF the ID of a plain HTML element, then it won't find anything in the component tree to regenerate the desired new HTML output for. Just replace the plain HTML element by a JSF component.

The PrimeFaces selectors get ultimately converted to HTML element IDs. PrimeFaces will loop over the elements found by the jQuery selector and extract their id attributes before passing to JSF. This is thus essentially the same problem as already answered here: Is it possible to update non-JSF components (plain HTML) with JSF ajax?.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555