I am trying to move away from using select2 multi-select. Ideally, I would like to call a function that returns the value for the kendo multi-select during initialization. The value will be retrieved by an AJAX call. Is there any way I could implement this? I tried using dataBound, but it looks like anything inside the data-bound will be called every time user clicks on the multi-select control.
During initialization, I don't want to call the dataSource. This will be updated every time user clicks open. I just need to update the value field based on the AJAX result.$("#multiselect").kendoMultiSelect({
dataSource: {
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/products",
dataType: "jsonp"
}
}
},
open: function(e){
// datasource is dynamic and should be updated with every click.
$('#multiselect').data('kendoMultiSelect').dataSource.read();
},
dataTextField: "ProductName",
dataValueField: "ProductID",
autoBind: false,
value: "IS IT POSSIBLE TO GET DATA FROM AJAX DURING INITIALIZATION?"
});