Hi,
Is there a way to data bind selected value to model. I have try to use this, data, and self but it does not work. What does work is creating a nested object and binding it to a user selection.
Below is what I am trying to do but it does not work:
Below is what I can do but feels funny:
Thanks,
Max
Is there a way to data bind selected value to model. I have try to use this, data, and self but it does not work. What does work is creating a nested object and binding it to a user selection.
Below is what I am trying to do but it does not work:
<div id="data-view" data-bind="source: this" data-template="data-view-template"></div><script type="text/html" id="data-view-template"> <div> <input id="search" data-role="autocomplete" data-bind="source: ds, value: this" data-text-field="Name" /> <div data-bind="text: Value"></div> </div></script>$(function () { var values = [{ Name: "Foo + Bar", Value: 1 }, { Name: "Foo - Bar", Value: 2 }, { Name: "Foo * Bar", Value: 3 }]; var model = kendo.observable({ Name: "???", Value: "???", ds: values }); kendo.bind($("#data-view"), model);});<script type="text/html" id="data-view-template"> <div> <input id="search" data-role="autocomplete" data-bind="source: ds, value: Person" data-text-field="Name" /> <div data-bind="text: Person.Value"></div> </div></script>var model = kendo.observable({ Person: { Name: "???", Value: "???", }, ds: values});Max