How can I replace the Kendo UI MultiSelect dataSource values from external .js file...
PS: Actual values are coming from index.html
file like below:
index.html
<select multiple="multiple" class="city_fields initi-select-218" id="test">
</select>
var data = [
"New Jersey",
"San Francisco",
"Las Vegas",
"Chicago",
"Los Angeles",
"New York"
];
jQuery(".city_fields").kendoMultiSelect({
dataSource: data,
filter: "contains",
});
Above values I am trying to replace from init.js (external) file as below...
init.js
Tried Option 1:
var newData = ["Delhi", "Bangalore"];
jQuery(".initi-select-218").kendoMultiSelect({
dataSource: newData,
filter: "contains",
placeholder: "Select",
});
Tried Option 2:
var newData = ["Delhi", "Bangalore"];
$("#test").kendoMultiSelect({
dataSource: newData,
filter: "contains",
placeholder: "Select",
});
$("#test").setDataSource(new kendo.data.DataSource({ data: newData }));
Tried Option 3:
var newData = ["Delhi", "Bangalore"];
var multiselect = $("#test").data("kendoMultiSelect");
multiselect.setDataSource(new kendo.data.DataSource({ data: newData }));
For Option 2 & 3, I am getting error as
Uncaught TypeError: $(...).setDataSource is not a function
...
But still, it is taking the values from index.html
file
` tag... relevant code is above of external file
– Reddy Jan 20 '16 at 13:25