P: ajax getter for update called before the listener

Here is my checkbox. I am preparing a comma-separated list of component identifiers in a listener. The problem here is that getter getUpdateComponentList () is called before the listener is called. Therefore, the string is never updated.

<p:outputPanel>
<h:selectManyCheckbox value="#{form.colors}">
  <f:selectItems value="#{form.colorItems}"/>
  <p:ajax listener="#{form.testListener}" event="change" update="#{form.updateComponentList}"  />
</h:selectManyCheckbox>
</p:outputPanel>
+5
source share
2 answers

Expected Behavior. PrimeFaces (and standard JSF) does not overestimate the attributes update(and render, oncompleteetc.) for each request. They are rated on a per-view basis. For example, RichFaces does this in its own way <a4j:ajax>and gives exactly the expected behavior.

PrimeFaces update RequestContext#addPartialUpdateTarget() #addPartialUpdateTargets() .

.

RequestContext.getCurrentInstance().addPartialUpdateTargets(updateComponentList);

Collection<String>, List<String> Set<String>.

, event="change" . .


PrimeFaces, , PrimeFaces; update() ( String, Collection<String>).

RequestContext.getCurrentInstance().update(updateComponentList);
+9

"", "". "p: ajax" - , - .

:

<p:outputPanel>
  <h:selectManyCheckbox value="#{form.colors}">
    <f:selectItems value="#{form.colorItems}"/>
    <p:ajax event="change" listener="#{form.testListener}" />
    <p:ajax event="change" update="#{form.updateComponentList}" />
  </h:selectManyCheckbox>
</p:outputPanel>
+2

All Articles