Class SelectItemGroups

  • All Implemented Interfaces:
    PartialStateHolder, StateHolder, TransientStateHolder, ComponentSystemEventListener, FacesListener, SystemEventListenerHolder, EventListener

    public class SelectItemGroups
    extends 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 jakarta.faces.model.SelectItemGroup. There is no equivalent (yet) in the standard Faces 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.

    Usage

    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>
     
    Since:
    3.0
    Author:
    Bauke Scholtz
    • Field Detail

      • COMPONENT_TYPE

        public static final String COMPONENT_TYPE
        The component type, which is "org.omnifaces.component.model.SelectItemGroups".
        See Also:
        Constant Field Values
    • Constructor Detail

      • SelectItemGroups

        public SelectItemGroups()