0
I cannot capture the change event of the p:selectOneMenu component, whose upload source is an Enum. I registered in my view the Ajax change event, 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>
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 to the Component System does not print the information on the console, i.e., 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 run.