Single selection (select1)Minimal appearance (dropdown)Basic usage
AppearanceCompact appearance (list box)Basic usage
AppearanceFull appearance (radio buttons)Basic usage
AppearanceMultiple selection (select)Compact appearance (list box)Basic usage
Appearance
Using itemsets
In the examples above, the labels and values for the Alternatively the
label/value pairs can be pulled out from an instance. You do this with an
[TODO: more on itemsets] Extension attributes
Use of the @class and @style attributesSelection controls support theclass and style attributes:
class attribute with a hierarchical instance and itemset:<xforms:instance id="itemset"> <items> <item id="1"/> <item id="2"> <item id="2.1"/> <item id="2.2"> <item id="2.2.1"/> <item id="2.2.2"> <item id="2.2.2.1"/> <item id="2.2.2.2"/> </item> </item> </item> </items></xforms:instance>The following selection control with tree appearance uses the class attribute<xforms:select ref="value" appearance="xxforms:tree"> <xforms:itemset ref="instance('itemset')//item" class="my-{if (exists(*)) then 'folder' else 'leaf'}"> <xforms:label ref="@id"/> <xforms:value ref="@id"/> </xforms:itemset></xforms:select>In this case, the class attribute is an AVT setting a different class depending on whether the item is a leaf item or not.Internal appearanceWhen the
xxforms:internal appearance is used, the selection control does not have any visual representation on the client.
This appearance is useful to implement custom selection controls with XBL and/or JavaScript.
Tree appearanceFor select and select1If you specifyappearance="xxforms:tree" on an <xforms:select> or <xforms:select1>, it will be rendered as a tree, as shown in the screenshots below. The nesting of the tree nodes in the UI will follow the nesting of the nodes you point to with <xforms:itemset ref="...">.Styling of the nodesYou can use an AVT in the the
class attribute on the <xforms:itemset> to produce different CSS classes for different nodes, which you can then, for instance, be used to show different icons for different nodes. You'll find more information about this in how to add different icons to tree nodes.TooltipIf you with have a tooltip show when users mouse over the "+" and "-" icons, add the class
xforms-show-tooltip on your <xforms:select> or <xforms:select1>. The tooltip will use the label of the node followed by either "Expand" or "Collapse". At this point, you can't change or localize this text.IncrementalBy default,
<xforms:select> and <xforms:select1> with appearance="xxforms:tree" behave as if incremental="true" was set: as soon as users select a node, the change is reflected in the instance. If you specify incremental="false" changes are only reflected when users move the focus to another control.Controlling which tree nodes are initially open[SINCE: 2010-11-15]
The
<xforms:itemset> element supports the xxforms:open extension attribute, which determines which nodes of the tree are open when the tree is first rendered. You can use <xforms:itemset xxforms:open="true"> if you want all the nodes to be open. If you have a condition under which nodes should be open, use an AVT. For instance, the following will open just the first level of the tree. If you wanted to open all the nodes up to 3 levels of depth, you would instead write {count(ancestor-or-self::item) le 3}.
|









