模特:
exports.definition = {
config: {
"columns": {
"id":"INTEGER PRIMARY KEY AUTOINCREMENT",
"title":"TEXT",
"file":"TEXT UNIQUE",
"desc":"TEXT",
"media":"TEXT",
"type":"TEXT"
},
"adapter": {
"type": "sql",
"collection_name": "downloads",
"db_name":"downloads.db",
"idAttribute":"id"
}
},
extendModel : function(Model) {
_.extend(Model.prototype, {
});
return Model;
},
extendCollection : function(Collection) {
_.extend(Collection.prototype, {
});
return Collection;
}
};
请注意,id
列是autoincrement
。
观点:
<ListItem title:text="{title} - {media}" subtitle:text="{desc}" itemId="{id}" />
请注意,它已绑定到id
列。
如果我在未指定id
的情况下呼叫以下内容(我不必这样做。它会自动增加):
collection.create({title:'title',desc:'desc',file:'file',media:'media',type:'type'});
我收到错误:
[ERROR] : Script Error {
[ERROR] : column = 10;
[ERROR] : line = 4;
[ERROR] : message = "Can't find variable: id";
[ERROR] : stack = "anonymous\ntemplate@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/underscore.js:1:13899\nt@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/controllers/download.js:1:1326\ntrigger@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/backbone.js:1:1353\n_onModelEvent@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/backbone.js:1:9447\ntrigger@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/backbone.js:1:1441\nadd@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/backbone.js:1:6798\ncreate@file:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/alloy/backbone.js:1:8655\nfile:///var/mobile/Containers/Bundle/Application/7C3527BC-5AC3-4CF0-974D-58F4C5717601/FRCC.app/downloadmanager.js:1:481";
[ERROR] : }
这只是在升级之后。任何的想法?从我的角度来看一个错误或什么东西?
感谢。
答案 0 :(得分:1)
你遇到了一个错误。希望是我们在Alloy数据绑定中解决的一系列错误中的最后一个。请注意并遵循进度,因为我正在修复此错误..现在