Titanium Studio, build: 3.3.0.201407100905 Mac OSX Mavericks 10.9.5 Titanium SDK 3.3.0 Platform: Android Device with 4.3.1, iOS Device (versions 7 and 8)
I've got a problem in my controller when I try to save on internal sqlite db. I create the model named memo.js
exports.definition = { config: { // No need to define columns object, loading the db_file // below will do that for us. columns: { "id": "INTEGER PRIMARY KEY", "idtab": "text", "tipo": "text" }, adapter: { "type": "sql", "collection_name": "memo", "db_file": "/db.sqlite", "db_name": "memo", "idAttribute": "id", "remoteBackup": false } }, extendModel: function(Model) { _.extend(Model.prototype, { // extended functions and properties go here }); return Model; }, extendCollection: function(Collection) { _.extend(Collection.prototype, { // extended functions and properties go here }); return Collection; } };The db.sqlite is in the
app/asset/ directory. In my controller I've got:
var mymemo = Alloy.createCollection('memo'); function addMemo(){ var thisID = $.addMemo.myid; alert("Show Room added to Memo"); var newMemo = Alloy.createModel('memo',{idtab:thisID,tipo:'1'}); mymemo.add(newMemo); newMemo.save(); }But when I close the app (remove it from the active application with the "swipe" in android and iOS) the record is not in the memo table, so is not saved in my db. I checked in the Q&A but anyone has got my problem...
Where's the problem?
Thans Angelo