我是新來作爲一個整體(劍道UI & & MVVM)。劍道UI MVVM數據與JayData
我想要一個下拉列表綁定在本地數據庫,它的上線拋出一個錯誤標記// < < < < < <
我在做什麼錯在這裏? - 我已經看到了JayData上可用的示例,但它並未清楚如何綁定本地數據庫。
我的代碼看起來像這樣。
<div id="wrapper">
<div id="NESTForm">
<select data-role="dropdownlist" data-value-field="UserID" data-text-field="Name"
data-bind="source: userSource">
</select>
</div>
</div>
<script>
var userDB;
$(document).ready(function() {
$data.Entity.extend("Users",
{
UserID: { type: "int", key: true, required: true },
Name: { type: "string", required: true }
});
$data.EntityContext.extend("EXAMPLEDB", {
Users: { type: $data.EntitySet, elementType: Users }
});
userDB = new EXAMPLEDB({
name: "webSql", databaseName: "EXMPLEDB",
dbCreation: $data.storageProviders.DbCreationType.DropTableIfChange
});
var viewModel = kendo.observable({
//Initial data binders ,
userSource: userDB.Users.asKendoDataSource() //<<<<<< this throws error
});
// apply the bindings
kendo.bind(document.body.children, viewModel);
});
</script>
的錯誤是
Uncaught TypeError: Object function (a,b){var c=this,d,e;c.trigger(w,{field:a}),a==="this"?d=c:(e=O[a]=O[a]||n.getter(a,!0),d=e(c),b&&typeof d=="function"&&(d=d.call(c)));return d} has no method 'push'