I have a KendoUI AutoComplete control bound to a list of objects. What I can't figure out is how to set the selected value of the AutoComplete from javascript. For example:
<input id="autocomplete" />
<script>
$("#autocomplete").kendoAutoComplete({
dataTextField: "Name",
dataSource: [
{ id: 1, Name: "Apples" },
{ id: 2, Name: "Oranges" },
{ id: 3, Name: "Carrots" } ]
});
$("#autocomplete").data("kendoAutoComplete").value({ id: 2, Name: "Oranges" });
</script>
This just results in the AutoComplete control showing [object Object]. A jsBin of the problem is available here: jsBin
Any suggestions? Jason
Answer from OnaBai
$("#autocomplete").data("kendoAutoComplete").value("Oranges");