Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Listview dosen't refresh when adding model items to the collection

$
0
0

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);

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>