f:ajax listener not called for h:selectBooleanCheckbox
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.
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 !
精彩评论