Skip to content

Instantly share code, notes, and snippets.

@kevinbubu
Last active December 17, 2015 11:39
Show Gist options
  • Save kevinbubu/5603768 to your computer and use it in GitHub Desktop.
Save kevinbubu/5603768 to your computer and use it in GitHub Desktop.
var win = Ti.UI.createWindow({
backgroundColor:'#fff'
});
var data = [];
for(var i = 0; i < 10 ; i++){
var row = Ti.UI.createTableViewRow({
height:90
});
var view = Ti.UI.createView({
backgroundColor:'#' + i + i + i,
width:120,
height:80,
left:10,
top:5
});
row.add(view);
var title1 = Ti.UI.createLabel({
text:'row ' + i,
width:120,
height:20,
top:10,
left:150
});
row.add(title1);
var title2 = Ti.UI.createLabel({
text:'Hello JSDC !',
color:'RED',
width:120,
height:20,
top:60,
right:20
});
row.add(title2);
data.push(row);
}
var table = Ti.UI.createTableView({
data:data
});
win.add(table);
table.addEventListener('click', function(e){
alert('I click row ' + e.index);
});
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment