Search code examples
databasetableviewtitaniumrow

Table row editable in Titanium SDK


I am learning Titanium SDK and I have a small .js file where I pull data from a sqlite database and I have the editable property set on rows.

I can only test Android since I am on a PC so my question is if that property is set and if the user on a iPhone decides to delete a row how will it react with the database, will it ignore that database row data on the next startup and stay changed forever in the app or will it always refresh the data and make the table from scratch?

The code looks like this:

var tableview = Titanium.UI.createTableView({color:'black',editable:true,search:search,editing:true});


var db = Titanium.Database.install('base.sqlite','base.sqlite');
var sql = db.execute('SELECT * FROM table1 GROUP BY name');

var data= [];

while(sql.isValidRow()) {

var name = sql.fieldByName('name');
var mID = sql.fieldByName('id');
data.push({title:name, hasChild:true, id:mID, url:'test.js', color:'black'});
sql.next();
}

Solution

  • The app will always create the tableview from your data. You must update your data in the delete event of the tableview.