I can not catch the change event of component p: selectOneMenu, whose load source is an enum. I registered in my view the change event of Ajax, however the listener method is not called.
My view uses the following code to load the combo:
<p:selectOneMenu id="analise" value="#{fooMB.analise}" converter="AnaliseConverter">
<f:selectItem itemLabel="Selecione"/>
<f:selectItems value="#{fooMB.carregarComboAnalise}" var="analise" itemLabel="#{analise.descricao}" itemValue="#{analise}/>
<f:ajax event="change" listener="#{fooMB.changeComboAnalise}"/>
</p:selectOneMenu>
The enum has the following code:
public enum AnaliseEnum {
AVALIACAO("Avaliação"),
SUGESTAO("Sugestão"),
RECLAMACAO("Reclamação"),
OUTROS("Outros");
private String descricao;
private AnaliseEnum(String descricao) {
this.descricao = descricao;
}
public String getDescricao() {
return this.descricao;
}
}
My ManagedBean has the following method used to load the combo:
public AnaliseEnum[] carregarComboAnalise() {
return AnaliseEnum.values();
}
My converter has the following code:
@FacesConverter(value = "AnaliseConverter")
public class AnaliseConverter extends EnumConverter {
public AnaliseConverter() {
super(AnaliseEnum.class);
}
}
The method added in the component's listener does not print the information on the console, that is, it is not triggered.
public void changeComboAnalise(AjaxBehaviorEvent event) {
System.out.println("Deveria fazer alguma coisa aqui, mas não faz .... ");
}
The combo loads normally, but the changeComboAnalise () method called in the "change" event does not execute.