Data and Value Binding
The ComboBox enables you to configure its predefined list of options and selected value.
To bind the ComboBox to data, use the
data property of the component.
data property accepts both:
The following example demonstrates how to bind the ComboBox to an array of primitive values.
If the ComboBox is bound to a dataset of objects, the value of the component will correspond to the selected object. To implement the approach, set the
By default, the ComboBox compares the items by reference. To specify a field from the data object which will be used for the comparison, utilize the
dataItemKey property. The
dataItemKey property is useful when the reference to the selected item which is configured in the
defaultValue property do not match its corresponding item from the
data collection. If
dataItemKey is not set and the references in
value do not correspond, the selected item will not be highlighted in the drop-down list.
To render the selected value, use the
value property of the ComboBox. If you set the value through the
value property, hook up to the
onChange event and manually update the value of the