4

With code like this :

<h:selectBooleanCheckbox value="#{user.data['selected']}">
      <f:ajax event="click" listener="#{timetableBean.processUserEvents}"  />
      <f:attribute name="user" value="#{user}" />
</h:selectBooleanCheckbox>

The method code is :

public void processUserEvents(AjaxBehaviorEvent e) {
  User user = (User) e.getComponent().getAttributes().get("user");
  ...
}

Clicking on the checkbox does trigger the ajax submit, but the listener method is not being called at all. To top it off, there's no error messages, and the phases complete normally.

Im was trying mojarra 2.0.4-b09, and after facing this error, i changed to 2.1.2, but the same problem persists.

Is there anything i did wrong ?

Thank you.


UPDATE

The problem was placing the h:selectBooleanCheckbox inside the primefaces datalist (p:dataList). Placing it outside works fine. I wonder what the problem is. Will ask in the primefaces forum now.

Bertie
  • 17,277
  • 45
  • 129
  • 182
  • Does your listener method signature match `public void processAjaxBehavior(javax.faces.event.AjaxBehaviorEvent event)` ? – Matt Handy Jul 20 '11 at 11:04
  • @Matt Handy: thank you, i've already updated my post above, and yup, i have that signature. – Bertie Jul 20 '11 at 12:18

1 Answers1

4

Here lies the answer of a similar problem.

The problem was really putting the checkbox inside p:dataList without encapsulating it in a p:column.

After wrapping it with p:column, the listener will be called normally.

Hope it helps !

Community
  • 1
  • 1
Bertie
  • 17,277
  • 45
  • 129
  • 182