Skip to content

Instantly share code, notes, and snippets.

@hal-gh hal-gh/gist:465934

Created Jul 6, 2010
Embed
What would you like to do?
var win = Titanium.UI.currentWindow;
win.backgroundColor = '#fff';
win.layout = 'vertical';
var CONTROL_HEIGHT = 34;
titles = [
{ title: 'This is row 0 (from array)'},
{ title: 'This is row 1 (from array)'},
{ title: 'This is row 2 (from array)'},
{ title: 'This is row 3 (from array)'},
{ title: 'This is row 4 (from array)'},
{ title: 'This is row 5 (from array)'},
{ title: 'This is row 6 (from array)'},
{ title: 'This is row 7 (from array)'},
{ title: 'This is row 8 (from array)'},
{ title: 'This is row 9 (from array)'}
];
var dataArray = [];
for (var i=0; i < 10; i++){
var row = Ti.UI.createTableViewRow({
className: 'todo_row',
height: 50,
width: 'auto'
});
var label = Ti.UI.createLabel({
color:'#222',
top:20,
width: 'auto',
text: titles[i].title
});
row.add(label);
dataArray.push(row);
}
var tableview = Ti.UI.createTableView({
backgroundColor:'#EDECEB',
data:dataArray,
editable:true,
bottom: '50'
});
tableview.addEventListener('click', function(e){
Ti.API.info('tableview eventlistener - you clicked table row index: '+e.index);
Ti.API.info('tableview eventlistener - click source'+e.source);
});
win.add(tableview);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.