Created
July 6, 2010 21:19
-
-
Save hal-gh/465934 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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