New to Kendo UI for jQuery? Download free 30-day trial

Selected MultiSelect Item Is Lost When Bound to Shared Data Source

Environment

Product Progress® Kendo UI® for jQuery MultiSelect Progress® Kendo UI® for jQuery DataSource
Operating System Windows 10 64bit

Description 

The selected item in the jQuery MultiSelect gets lost when bound to a shared data source.

Cause

This behavior is expected. The selected item of the component is directly related to the data source view and if it does not contain the selected item, then the widget removes its current value.

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").kendoMultiSelect({
    dataSource: ds
});

$("#ms2").kendoMultiSelect({
    dataSource: ds
});

The following example demonstrates the solution to the sample issue.

var ds = new kendo.data.DataSource({ data: ["foo", "bar"] });
ds.read();

$("#ms1").kendoMultiSelect({
    dataSource: new kendo.data.DataSource({ data: ds.data() });
});

$("#ms2").kendoMultiSelect({
    dataSource: new kendo.data.DataSource({ data: ds.data() });
});

See Also

In this article