I would like to use the example from the primefaces showcase to group selectItems in selectOneMenu:
<h:outputText value="Grouping: " />
<p:selectOneMenu value="#{formBean.car}">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{formBean.cars}" />
</p:selectOneMenu>
My problem is, that there is no implementation of the bean. Now I don’t know, how to implement the grouping of the selectItems inside the method getCars(). And I can’t find any other example.
The source code of the showcase’s
#{formBean}is available here. Here’s an extract of relevance:Thus, your missing key is
SelectItemGroup.See also:
selectOneMenuwiki page – "Dynamic list with groups"