Reputation: 2735
The Model:
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;
}
};
Note that the column id
is autoincrement
.
The View:
<ListItem title:text="{title} - {media}" subtitle:text="{desc}" itemId="{id}" />
Note that it's bound to the id
column.
If I'm calling the following without specifying id
(I don't have to. It's auto-incremented):
collection.create({title:'title',desc:'desc',file:'file',media:'media',type:'type'});
I get an error:
[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] : }
This is only after the upgrade. Any idea? A bug or something broken just from my end?
Thanks.
Upvotes: 0
Views: 103
Reputation: 3866
You've hit a bug. Hopefully the last one in a series of bugs we're solving in Alloy data binding. Please watch and follow progress as I'll be fixing this bug right.. now
https://jira.appcelerator.org/browse/ALOY-1477
Upvotes: 1