0

Hi guys is there a way to fire an ajax call in a p:selectManyCheckbox of primefaces once I check one of them? something like this:

<p:selectManyCheckbox  label="Elements" value="#{crearVacacionMB.elementSelected}" layout="grid" columns="1">
    <f:selectItems  value="#{MB.elements}" />
    <p:ajax event="check" listener="#{MB.function}"/>
</p:selectManyCheckbox>

And my MB:

public void function(AjaxBehaviorEvent event){
    System.out.println("I was fired");

}
DuSant
  • 970
  • 12
  • 25

1 Answers1

6

The code you posted produces a JSF error, at least with Mojarra 2.2, and I am surprised you haven't mentioned it:

<p:ajax> Event:check is not supported.

Remove the event attribute from <p:ajax>: the ajax behaviour will default to the default event valueChange:

<p:ajax listener="#{MB.function}"/>

Links:

Community
  • 1
  • 1
perissf
  • 15,979
  • 14
  • 80
  • 117