public class SelectItemGroups
extends javax.faces.component.UISelectItems
The o:selectItemGroups
is an extension of UISelectItems
which allows you to iterate over a
nested collection representing groups of select items. This is basically the UIComponent
counterpart of
javax.faces.model.SelectItemGroup
. There is no equivalent (yet) in the standard JSF API. Currently the
only way to represent 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>
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_TYPE
The standard component type.
|
Constructor and Description |
---|
SelectItemGroups() |
Modifier and Type | Method and Description |
---|---|
Object |
getValue()
An override which wraps each UISelectItem(s) child in a
SelectItemGroup . |
void |
setValueExpression(String name,
javax.el.ValueExpression binding)
An override which checks if this isn't been invoked on
var attribute. |
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, visitTree
public static final String COMPONENT_TYPE
public void setValueExpression(String name, javax.el.ValueExpression binding)
var
attribute.
Finally it delegates to the super method.setValueExpression
in class javax.faces.component.UIComponent
IllegalArgumentException
- When this value expression is been set on var
attribute.public Object getValue()
SelectItemGroup
.getValue
in class javax.faces.component.UISelectItems
Copyright © 2012–2017 OmniFaces. All rights reserved.