Selected ComboBox Item Is Lost When Bound to a Shared Data Source
Environment
Product | Progress® Kendo UI® ComboBox for jQuery |
Operating System | Windows 10 64bit |
Description
The selected jQuery ComboBox item is lost when it is bound to the shared DataSource.
Cause
The selected item of the widget is directly related to the data source view. If it does not contain the selected item, then the widget will remove its current value. Such behavior is expected.
Solution
To handle this issue, use separate data sources.
The following example demonstrates a sample issue.
var ds = new kendo.data.DataSource({ data: ["foo", "bar"] });
$("#ms1").kendoComboBox({
dataSource: ds
});
$("#ms2").kendoComboBox({
dataSource: ds
});
The following example demonstrates the solution to the above issue.
var ds = new kendo.data.DataSource({ data: ["foo", "bar"] });
ds.read();
$("#ms1").kendoComboBox({
dataSource: new kendo.data.DataSource({ data: ds.data() });
});
$("#ms2").kendoComboBox({
dataSource: new kendo.data.DataSource({ data: ds.data() });
});