Skip to content

Instantly share code, notes, and snippets.

@hal-gh
Created July 22, 2010 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hal-gh/485832 to your computer and use it in GitHub Desktop.
Save hal-gh/485832 to your computer and use it in GitHub Desktop.
// create table view data object
var data = [];
data[0] = Ti.UI.createTableViewRow({hasChild:true,title:'Row 1'});
data[1] = Ti.UI.createTableViewRow({});
data[2] = Ti.UI.createTableViewRow({hasCheck:true,title:'Row 3'});
data[3] = Ti.UI.createTableViewRow({title:'Row 4'});
var label = Ti.UI.createLabel({
backgroundColor:'red',
font:{fontFamily:'sans-serif', fontSize:20},
text:'Debug Mode'
});
data[1].add(label);
// create table view
var tableview = Titanium.UI.createTableView({
data:data
});
// create table view event listener
tableview.addEventListener('click', function(e)
{
// event data
var index = e.index;
var section = e.section;
var row = e.row;
var rowdata = e.rowData;
Titanium.UI.createAlertDialog({title:'Table View',message:'row ' + row + ' index ' + index + ' section ' + section + ' title ' + rowdata.title}).show();
});
// add table view to the window
Titanium.UI.currentWindow.add(tableview);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment