selectItems - Selection Items
Provides one or more items for user selection, for example, in a check box.
Category
NoneSyntax
<xp:selectItems attributes>content</xp:selectItems>| Property | Description |
|---|---|
| value | Provides labels, values, descriptions, and disable flags for one or more description items. A value here is different from data binding. |
| Category | Properties |
|---|---|
| basics | attrs, binding, id, loaded, rendered, rendererType |
| data | value |
| format | disableTheme, themeId |
Usage
Embed this control in another control to provide item selections for the parent control.In Design mode,
put focus on the control that is to contain the item selection and
click the Values tab under Properties.
Use Add formula item to create a selectItems control.
To
see the item selection properties under All properties,
you must switch to Source mode and put focus on the embedded selectItems control
(as opposed to the parent control).
The value formula must return
an array. Each element of the array must define one selection item
formatted as follows:
label|value|description|disabledWhere
only label is required. The vertical bars are part
of the syntax.If value is not specified, it
defaults to label. Specify disabled as true to
disable (gray out) the selection item.
For the return value,
you can explode (@Explode) the result of @DbColumn or @DbLookup.
Examples
This Check Box Group control contains two items for selection.<xp:checkBoxGroup id="checkBoxGroup1" value="#{document1.fruit}">
<xp:selectItems>
<xp:this.value>
<![CDATA[#{javascript:return new Array("Apples", "Oranges")}]]>
</xp:this.value>
</xp:selectItems>
</xp:checkBoxGroup>This Check Box Group control
uses different names for the labels and values.
<xp:checkBoxGroup id="checkBoxGroup1" value="#{document1.fruit}">
<xp:selectItems>
<xp:this.value>
<![CDATA[#{javascript:return new Array("Apples|apples", "Oranges|oranges")}]]>
</xp:this.value>
</xp:selectItems>
</xp:checkBoxGroup>This Check Box Group control
disables the first selection.
<xp:checkBoxGroup id="checkBoxGroup1" value="#{document1.fruit}">
<xp:selectItems>
<xp:this.value>
<![CDATA[#{javascript:return new Array("Apples|apples||true", "Oranges|oranges")}]]>
</xp:this.value>
</xp:selectItems>
</xp:checkBoxGroup>This Check Box Group gets
its item selections from the values in a view column.
<xp:checkBoxGroup id="checkBoxGroup1" value="#{document1.fruit}">
<xp:selectItems>
<xp:this.value>
<![CDATA[#{javascript:var list = @DbColumn("", "fruits", 1);
return @Explode(list,",")}]]>
</xp:this.value>
</xp:selectItems>
</xp:checkBoxGroup>