hi there, i can push the data to tableview but i couldn't figure how to do this with tableviewrows? because i must to add images and customize the fonts
list.js
Ti.include("functions.js"); var data = []; //empty data array var tblFavorites = Titanium.UI.createTableView({ top: 0, left: 0, color:'#e8e8e8' }); mywindow.add(tblFavorites); function loadFavorites(){ data = []; //set our data object to empty data = getFavorites(); tblFavorites.data = data; } //the focus event listener will ensure that the list //is refreshed whenever the tab is changed mywindow.addEventListener('focus', loadFavorites);functions.js
function getFavorites() { var db = Ti.Database.open('mydb'); var sql = "SELECT id,baslik FROM liste ORDER BY baslik ASC"; var results = []; var resultSet = db.execute(sql); while (resultSet.isValidRow()) { results.push({ id: resultSet.fieldByName('id'), title: resultSet.fieldByName('baslik') }); //iterates to the next record resultSet.next(); } //you must close the resultset resultSet.close(); db.close(); //finally, return our array of records! return results; }and for my query this is not working
var kategori = 3; var sql = "SELECT * FROM klipler WHERE kategori ="+ kategori +" kategori ORDER BY baslik ASC";what should i use ?
Thanks
2 Answers
Accepted Answer
There are examples of this in the kitchen sink application, you should check it out.
Basically just create TableViewRow object, add content and add that object to an array. Build your array and set that as data in your tableview.
var data = []; data[0] = Ti.UI.createTableViewRow({hasChild:true,title:'Row 1'}); data[1] = Ti.UI.createTableViewRow({hasDetail:true,title:'Row 2'}); data[2] = Ti.UI.createTableViewRow({hasCheck:true,title:'Row 3'}); data[3] = Ti.UI.createTableViewRow({title:'Row 4'}); // create table view var tableview = Titanium.UI.createTableView({ data:data });
You need to create custom rows TableViews-Customrows
Your Answer
Think you can help? Login to answer this question!