我想将我的表单绑定到 kedno 可观察视图模型。我可以让它与硬编码值一起工作,但不是数据源。我已验证数据源在视图中有一项,我可以获取它。请参阅下面的代码。有任何想法吗?谢谢
//Hard coded first name binds to my form correctly
var viewModel = kendo.observable({
first_name: "John"
});
kendo.bind($("form"), viewModel);
//This doesn't bind correctly
var sharableDataSource = new kendo.data.DataSource({
transport: {
read: {
url: "myurl goes here" ,
dataType: "json"
}
}
});
var viewModel = kendo.observable({
datasource: sharableDataSource
});
kendo.bind($("form"), viewModel);
//HTML I am binding to
<li>First Name <span class="value" data-bind="text: first_name"> </span></</li>