OverviewSince 3.3 The ace:simpleSelectOneMenu component is simple selection component, similar to the standard h:selectOneMenu, that integrates well with the ACE environment by providing ajax support, ARIA support, label positions, and theming. Option items are defined by the <f:selectItem> tag. If the backing list is javax.faces.model.SelectItem objects the <f:selectItems> tag can be used. If the backing list is not made of SelectItem objects (such as a String[] array), see the Dynamic Items section below for information on how to render those items.
Getting StartedIn its simplest form, an ace:simpleSelectOneMenu component only requires to have some options defined and to bind its value to a property in a backing bean. <ace:simpleSelectOneMenu value="#{bean.category}"> <f:selectItem itemValue="a" itemLabel="Category A" /> <f:selectItem itemValue="b" itemLabel="Category B" /> <f:selectItem itemValue="c" itemLabel="Category C" /> </ace:simpleSelectOneMenu> Dynamic ItemsAs mentioned for a dynamic list not composed of SelectItem objects use a TagHandler (like <c:forEach>) to loop through your list and output individual <f:selectItem> tags. For example, where bean.category is a String[]: <ace:simpleSelectOneMenu value="#{bean.category}"> <f:selectItem itemLabel="-Select-" itemValue="None" noSelectionOption="true" /> <c:forEach items="#{categoryList.items}" var="currentCategory"> <f:selectItem itemValue="#{currentCategory}"/> </c:forEach> </ace:simpleSelectOneMenu>
Attributes
The value specifies a bean property to which the value of this component is bound to. Client Behavior Events
JavaScript APIsNot applicable. Keyboard and ARIA SupportFull ARIA support. Native <select> element preserved. The following ARIA roles are supported: select, option. LabelsThis component supports built-in labels. The text specified in the label attribute will be rendered next to the main input field of this component. The position specified by labelPosition will determine where this label is going to be rendered; the possible values are left, right, top, bottom, none and inField (to render the label in the field itself). Required IndicatorThe requiredIndicator attribute specifies the text to be displayed next to the main input field when this component is marked as required. When, this component is not marked as required, then the text specified in the optionalIndicator is going to be rendered. The indicatorPosition attribute determines where this indicator text is going to the rendered; the possible values are left, right, top, bottom, labelLeft, labelRight, and none. Required StylingThen this component is marked as required, the main input field receives the CSS class ui-state-required, otherwise, it receives the CSS class ui-state-optional. When this component is marked as invalid by the app, it will be rendered with the CSS class ui-state-error. These CSS classes can be used to add custom styling to this component, in order indicate its current state in a more visual way. CSS ClassesThe following markup represents the basic HTML structure of the component and the CSS classes it uses. <span class="ui-simpleselectonemenu [user defined classes]"> <select class="ui-widget ui-inputfield ui-state-default ui-state-optional" style="[user defined styles]"> <!-- option elements go here... --> </select> </span> Known IssuesNone. |
SimpleSelectOneMenu
© Copyright 2021 ICEsoft Technologies Canada Corp.