I'm struggling with the following issue in a web application using PrimeFaces 6.2 - and yes, I have read this and this and this and that and the wiki and took a look into the primefaces showcase as well.
The scenario: I have a selectOneMenu that gets its selectItems from a bean:
<p:selectOneMenu id="konfiguration" value="#{tpsManager.selectedKonfig}" >
<p:ajax event="change" listener="#{tpsManager.konfigChange}" />
<f:selectItems value="#{tpsManager.konfigurationen}" />
</p:selectOneMenu>
If the values are computed like this by getKonfigurationen() in the bean, a change-event is triggered if the user selects an item and konfigChange() is called:
ArrayList konfigurationen = new ArrayList<SelectItem>();
SelectItemGroup g1 = new SelectItemGroup("<Auswertungsbasis>");
g1.setSelectItems(new SelectItem[]{ new SelectItem("id Denver", "Denver" ), new SelectItem("id San Francisco", "San Francisco" ) });
konfigurationen.add(g1);
konfigurationen.add(0, new SelectItem("id new York", "New York" ));
return konfigurationen;
This is nice, but unfortunately I need to create the selectItems in the selectItemGroup dynamically since those values are provided by a database. In the following snippet the third line returns an Array of selectItem and adds this to SelectItemGroup g1. The array contains selectItem-objects (containing Strings) only and NO null entries.
ArrayList konfigurationen = new ArrayList<SelectItem>();
SelectItemGroup g1 = new SelectItemGroup("<Auswertungsbasis>");
g1.setSelectItems( al.toArray(new SelectItem[al.size()]) );
konfigurationen.add(g1);
konfigurationen.add(0, new SelectItem("id new York", "New York" ));
return konfigurationen;
The problem: if the user now selects an item NO change-event is triggered and konfigChange() is NOT called. No exception is raised. In the debugger both arrays look identially. I'm out of ideas - any help is appreciated!