-1
我想將我的表單綁定到kedno可觀察視圖模型。我可以讓它使用硬編碼的值,但不是DataSource。我已經驗證數據源在視圖中有一個項目,我可以獲取它。見下面的代碼。有任何想法嗎?謝謝Kendo View Model不與數據源綁定
//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>
@Downvoter請解釋反對票。 –