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

How to show one entry from a database every 20 seconds.

$
0
0

Hello,

What i'm trying to do is when the window opens I want to load the database and show one data entry every 20 seconds until it reaches the end of file.

var win = Ti.UI.createWindow({
        backgroundColor: '#1695A3'
    }); 
 
   //connect the database
    var db = Ti.Database.install('/donats.sqlite', 'donats');
 
    //Read the product names from our preiously selected category
    var rows = db.execute('SELECT * FROM names' );
 
    //Create the array
    var myArray = [];
 
    while(rows.isValidRow()) {
        dataArray.push({title:'' + rows.fieldByName('name')});
        rows.next();
    };
 
    //Attach the array to the tableView
    tableview.setData(dataArray);
};
 
//create a tableview
var tableview = Ti.UI.createTableView({
});
 
win.add(tableview);
 
win.open();

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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