Test code
/*jslint node: true */
"use strict";
/*global Titanium */
function rowClicked(e) {
Titanium.API.trace("ROW CLICKED: e = " + JSON.stringify(e));
}
var with_sections = true,
sectionOne = Titanium.UI.createTableViewSection({
headerTitle: 'section_one'
}),
sectionTwo = Titanium.UI.createTableViewSection({
headerTitle: 'section_two'
}),
tableview = Titanium.UI.createTableView({
height: Titanium.UI.FILL,
width: Titanium.UI.FILL,
top: 0,
showVerticalScrollIndicator: true,
minRowHeight: 48,
}),
rowOne = Titanium.UI.createTableViewRow({
title: 'row_one'
}),
rowTwo = Titanium.UI.createTableViewRow({
title: 'row_two'
}),
win = Titanium.UI.createWindow({ backgroundColor: '#fff' });
if (with_sections) {
sectionOne.add(rowOne);
sectionTwo.add(rowTwo);
tableview.setData([sectionOne, sectionTwo]);
} else {
tableview.setData([rowOne, rowTwo]);
}
tableview.addEventListener('click', rowClicked);
win.add(tableview);
win.open();
Behaviour under iOS
- with_sections = true: responds to row clicks, prints sensible e object
- with_sections = false: responds to row clicks, prints sensible e object
Behaviour under MobileWeb
- with_sections = true: IGNORES row clicks
- with_sections = false: responds to row clicks ALTHOUGH gives "Uncaught TypeError: Converting circular structure to JSON" error
Mobile Web has been deprecated and will be removed in fixVersion 7.0.0.