createTableViewRow... why does this not work?
What am I missing here?
I only get an empty table with no text.
var win1 = Ti.UI.createWindow({
backgroundColor:"#fff",
title:"Test"
});
var table1 = Ti.UI.createTableView({});
var row1 = Ti.UI.createTableViewRow({title:'Hello'});
table1.add(row1);
win1.add(table1);
win1.open();
edit: Updated code
3 Answers
-
Accepted Answer
should be appendRow
table1.appendRow(row1);
-
Do you have something like this in your code? Otherwise when you use "win1.add(table1);" you won't be adding it to anything.
var win1 = Titanium.UI.currentWindow;
Cheers
John
-
another way to add rows, which is used through out the kitchen sink examples is to create an array of rows and then just set the table data to that array
var dataArray = [ Ti.UI.createTableViewRow({title:'Hello One'}), Ti.UI.createTableViewRow({title:'Hello Two'}) ]; var table1 = Ti.UI.createTableView({data: dataArray}); win1.add(table1);