Listview dosen't refresh when adding model items to the collection. alert(info.length) is counting up however.. When I restart the app alla the data is showing up.
What is the problem?
Thanks in advance! :)
var info = Alloy.Collections.info; var counter = 1; // use a custom query to quickly empty the SQLite store var db = Ti.Database.open('_alloy_'); db.execute('DELETE FROM info;'); db.close(); function addInfoRow(e) { // create the info model var model = Alloy.createModel('info', { title: 'Name ' + counter, subtitle: 'Nickname ' + counter, template : "title" }); counter++; // add model to the collection and save it to sqlite info.add(model); model.save(); alert(info.length); //Is counting up info.fetch(); // Only first item is displayed } info.fetch(); $.addRow.addEventListener("click", addTestFighter);