blob: 514652b8812477b6c7f8f08f86189963fe79e23d [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<ui:composition template="/main.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<p>The <code class="language-markup">&lt;tc:selectOneListbox/></code> create a list of entries, where only one
entry can be selected. Items can be added with <code class="language-markup">&lt;tc:selectItem/></code>
or <code class="language-markup">&lt;tc:selectItems/></code>.</p>
<p>Tag Library Documentation:
<tc:link label="&lt;tc:selectOneListbox/>" image="#{request.contextPath}/image/feather-leaf.png"
link="#{apiController.tldBase}/#{apiController.currentRelease}/tld/tc/selectOneListbox.html"/>
|
<tc:link label="&lt;tc:selectItem/>" image="#{request.contextPath}/image/feather-leaf.png"
link="#{apiController.tldBase}/#{apiController.currentRelease}/tld/tc/selectItem.html"/>
|
<tc:link label="&lt;tc:selectItems/>" image="#{request.contextPath}/image/feather-leaf.png"
link="#{apiController.tldBase}/#{apiController.currentRelease}/tld/tc/selectItems.html"/></p>
<tc:section label="Basics">
<p>If the number of rows is not set, die height of the list depends on the number of entries.
The number of rows can be set by the <code>size</code> attribute.
A list has at least two rows, therefor values
less than two have no effect.</p>
<demo-highlight language="markup">&lt;tc:selectOneListbox label="List" size="3">
&lt;tc:selectItem itemLabel="Alpha"/>
...
&lt;/tc:selectOneListbox></demo-highlight>
<tc:selectOneListbox id="s1" label="List" size="3">
<tc:selectItem itemLabel="Alpha"/>
<tc:selectItem itemLabel="Beta"/>
<tc:selectItem itemLabel="Gamma"/>
<tc:selectItem itemLabel="Delta"/>
</tc:selectOneListbox>
<tc:selectOneListbox id="s2" label="Read Only" readonly="true" size="3">
<tc:selectItem itemLabel="Alpha"/>
<tc:selectItem itemLabel="Beta"/>
<tc:selectItem itemLabel="Gamma"/>
<tc:selectItem itemLabel="Delta"/>
</tc:selectOneListbox>
<tc:selectOneListbox id="s3" label="Disabled" disabled="true" size="3">
<tc:selectItem itemLabel="Alpha"/>
<tc:selectItem itemLabel="Beta"/>
<tc:selectItem itemLabel="Gamma"/>
<tc:selectItem itemLabel="Delta"/>
</tc:selectOneListbox>
</tc:section>
<tc:section label="Simple Usage">
<p>Select a river in the list. After pressing the submit-button, the length of the river is shown in the
output field.</p>
<p>Items are added with
<code class="language-markup">&lt;tc:selectItem itemLabel="Nile" itemValue="6853 km"/></code>.</p>
<tc:selectOneListbox id="riverList" label="River" value="#{selectOneListboxController.river}">
<tc:selectItem itemLabel="Nile" itemValue="6853 km"/>
<tc:selectItem itemLabel="Amazon" itemValue="6437 km"/>
<tc:selectItem itemLabel="Yangtze" itemValue="6300 km"/>
<tc:selectItem itemLabel="Yellow River" itemValue="5464 km"/>
<tc:selectItem itemLabel="ParanĂ¡ River" itemValue="4880 km"/>
</tc:selectOneListbox>
<tc:out id="riverOutput" label="Length" value="#{selectOneListboxController.river}"/>
<tc:button id="riverSubmit" label="Submit"/>
</tc:section>
<tc:section label="Ajax">
<p>Select a mountain in the list. The height will be displayed by
<code class="language-markup">&lt;tc:out id="selectedMountain" .../></code>. The
<code class="language-markup">&lt;tc:selectOneListbox/></code> contain a
<code class="language-markup">&lt;f:ajax render="selectedMountain"/></code>, which rerender the output field.</p>
<tc:selectOneListbox id="mountainList" label="Mountains" value="#{selectOneListboxController.mountain}">
<tc:selectItems value="#{selectOneListboxController.mountains}" var="mountain"
itemLabel="#{mountain.label}" itemValue="#{mountain.value}"/>
<f:ajax render="selectedMountain"/>
</tc:selectOneListbox>
<tc:out id="selectedMountain" label="Height" value="#{selectOneListboxController.mountain}"/>
</tc:section>
</ui:composition>