o:selectItemGroups is an extension of {@link UISelectItems} which allows you to iterate over a nested collection representing groups of select items.
This is the {@link UIComponent} counterpart of jakarta.faces.model.SelectItemGroup.
There is no equivalent (yet) in the standard JSF API. Currently the only way to represent {@link SelectItemGroup} in UI is to manually create and populate them in a backing bean which can end up to be quite verbose.
Below example assumes a List<Category> as value wherein Category in turn has a List<Product>.
<h:selectOneMenu value="#{bean.selectedProduct}" converter="omnifaces.SelectItemsConverter">
<f:selectItem itemValue="#{null}" />
<o:selectItemGroups value="#{bean.categories}" var="category" itemLabel="#{category.name}">
<f:selectItems value="#{category.products}" var="product" itemLabel="#{product.name}" />
</o:selectItemGroups>
</h:selectOneMenu>
| Info | Value |
|---|---|
| Component Type | org.omnifaces.component.model.SelectItemGroups |
| Handler Class | None |
| Renderer Type | None |
| Description | None |
| Name | Required | Type | Description |
|---|---|---|---|
value | true | jakarta.el.ValueExpression
(must evaluate to java.lang.Object)
| Any Iterable, Map or array of objects representing select item groups. |
var | false | java.lang.String |
The name of the EL variable which exposes the currently iterated select item group.
Defaults to item.
|
itemValue | false | jakarta.el.ValueExpression
(must evaluate to java.lang.Object)
| The value of the select item group. This will be exposed to any nested UISelectItem(s) children. Defaults to the currently iterated select item group. |
itemLabel | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
|
The label of the select item group.
Defaults to the String representation of itemValue.
|
Output generated by Vdldoc View Declaration Language Documentation Generator.