Problem Description
This bug exists only on mobile web, not on Android on iOS.
Screenshot of browser and description of bug
!
http://i.imgur.com/4O6TWd4.png!
* If you click on "One", you'll see an alert for index 0, as expected.
* If you click on "Three", you'll see an alert for index 1, as expected.
* If you click on "Two", you'll see an alert for index 2, as expected.
* If you click on "Four", you'll see an alert for index 2, **NOT AS EXPECTED**
* And indeed, if you add more rows to the "Evens" section, they will all alert index 2.
Also, the same problem occurs if I create the rows and sections using XML only.
Test case
win = Titanium.UI.createWindow({
backgroundColor : '#fff',
exitOnClose : true
});
var aTableView = Ti.UI.createTableView();
var sections = [];
sections.push(Ti.UI.createTableViewSection({
headerTitle : "Odds"
}));
sections[0].add(makeTableViewRow("One"));
sections[0].add(makeTableViewRow("Three"));
sections.push(Ti.UI.createTableViewSection({
headerTitle : "Evens"
}));
sections[1].add(makeTableViewRow("Two"));
sections[1].add(makeTableViewRow("Four"));
aTableView.setData(sections);
function makeTableViewRow(rowText) {
return Ti.UI.createTableViewRow({
title : rowText,
className : "row"
});
}
aTableView.addEventListener('click', function(e) {
alert( e.index);
});
win.add(aTableView);
win.open();
Steps to reproduce
1. Create a new project
2. Paste test code in app.js
3. Run on Mobile Web
4. Click on 4th Row its alert 2 but actual result 3
I have personally been involved in confirming the findings by Jonah in the Q&A, read the full interaction here; http://developer.appcelerator.com/question/159780/possible-bug-tableview-eventindex-is-wrong-when-tableview-has-sections I have confirmed the error does occur and that it only occurs in Mobile Web as other platforms report the correct response for the test case above.
Most recent builds tested with; Ti SDK 3.2.0.v20131117001643 Ti Studio 3.2.1.201311211948
Hello Jonah, Can you please post a test case that reproduces the issue in the form of a single app.js file? TIA! Best, Mauro
Mauro, Sorry, I'm in like my first week of learning appcelerator and only know how to make things with the Alloy style. However, it literally takes under 60 seconds to create a new Alloy project, paste in my 3 code snippets into .js, .tss, and .xml files, and see the error in action. HTH, Jonah
Resolving ticket as "Won't fix" as MobileWeb has been deprecated.
Closing as will not fix.