Dropdown¶
The Dropdown widget allows users to select a single option from a predefined list. This list can be populated statically or dynamically using data sources (see Data Sources for details). The widget includes a built-in search mechanism to facilitate selection from large lists. Selection is automatically mapped to the data model using the Selection Mapping feature.
Manual Entry¶
If the AllowNew property is set to true, users can enter values not present in the predefined list. Otherwise, only existing options can be selected.
XML Fields¶
Binding and Selection¶
XPathbinds the widget to the data model element that stores the selection.ValueXPathis a path relative to the bound element that receives the selected option's value, produced by the data sourceValueFormat.CaptionXPathis a path relative to the bound element that receives the option's display text, produced byTextFormat. For a selection field withCodeandNamechild elements, useCodeandName.- When
ValueXPathis empty, the value is written to the bound element itself, so the bound element must not have child elements. WhenCaptionXPathis empty, the display text is kept in aCaptionattribute of the bound element. This attribute is a legacy fallback that the data model does not declare; prefer a selection field withCodeandName. MappingXPathis a path relative to the bound element under which data source mappings andMapSelectioncopies are applied. Leave it empty to apply them to the bound element.
Choice Source¶
DataSourcesdefines the available options. A staticListItemDataSourceusesTextFormatfor visible text andValueFormatfor the stored value; other sources may obtain the same shape from a query or service.MonitoredXPathslists data paths that refresh the choices after they change. Use it for dependent dropdowns.CacheDataSourcescontrols whether the current source result is reused between refreshes.
Input Behavior¶
AutoSelectValueselects the first valid option when the current value is empty.AllowNewpermits a value that is not returned by the source.MapSelectionenablesMappingXPathprocessing.Sizecontrols width.RequiredForGroupapplies required validation when a button validates the same group.Hintssupplies help text andRulescontains formatting or validation rules.
Automatic Value Selection¶
By default, the first available item is selected when the widget loads if the corresponding data model element is empty. This behavior can be disabled by setting the AutoSelectValue property to false. With AutoSelectValue set to false, no item is pre-selected; user selection is required if a value is mandatory.
Selection Mapping¶
The selected item's value is written to the ValueXPath element, and its display text is written to the CaptionXPath element. Both paths are relative to the widget's bound element.
To map additional item properties to other data model elements, set the MapSelection property to true. The mapping root path defaults to the widget's XPath but can be customized using the MappingXPath property.
See the Selection Mapping Example for an illustration.
Data Source Caching¶
For improved performance, the widget caches data sources by default. This caching can be disabled by setting the CacheDataSources property to false. Disabling caching causes data sources to be reloaded each time the widget is rendered.
Simple Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
Related Pages¶
Selection Mapping Example¶
Consider the following data model:
1 2 3 4 5 | |
The following example demonstrates how the selected item's MappedField value is automatically copied to the MappedField element in the data model upon selection:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |