[TIMOB-14902] Android: ListView itemclick event broken in 3.1.2.GA
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Duplicate |
| Resolution Date | 2013-08-17T01:34:57.000+0000 |
| Affected Version/s | Release 3.1.2 |
| Fix Version/s | 2013 Sprint 17, 2013 Sprint 17 API, Release 3.1.3, Release 3.2.0 |
| Components | Android |
| Labels | 3.1.2, android, listview, qe-testadded, regression |
| Reporter | Mark Mokryn |
| Assignee | Ping Wang |
| Created | 2013-08-16T21:54:40.000+0000 |
| Updated | 2014-06-19T12:43:35.000+0000 |
Description
Just try to click the ListView in the label area. In 3.1.2.GA it rarely works, on 3.1.1.GA clicks reliably. This bug seems to be dependent upon the item template - I have listviews in my app that are totally unclickable. Sorry to vent about this - Android has several ListView issues, I can work around most of them, but this one is a showstopper. I can't use 3.1.2 until fixed.
index.xml:
<Alloy>
<Window class="container">
<ListView id="lv" top="0dp" defaultItemTemplate="temp1" onItemclick="lvClicked">
<Templates>
<ItemTemplate name="temp1">
<Label bindId="testMsg"/>
</ItemTemplate>
</Templates>
<ListSection id="ls"/>
</ListView>
</Window>
</Alloy>
index.js:
function lvClicked() {
alert('clicked');
}
var data = [];
for (var i=0; i < 10; i++) {
data.push({testMsg: {text: 'try to click on the label area - it will work with 3.1.1 but not on 3.1.2 :('}});
}
$.ls.setItems(data);
$.index.open();
Linking to a TIMOB ticket. TIMOB-14901
Test case for classic Titanium project:
var temp1 = { childTemplates: [ // Add view subcomponents to the ListItem { // Display a Label type: 'Ti.UI.Label', bindId: 'testMsg' } ] }; var listView = Titanium.UI.createListView({ templates: {'temp1': temp1}, defaultItemTemplate: 'temp1' }); // Simplest list data items that can be displayed in a list view var data = []; for (var i=0; i<10; i++) { data.push({testMsg: {text: 'try to click on the label area - it will work with 3.1.1 but not on 3.1.2 :('}}); } // Add the list data items to a section var ls = Titanium.UI.createListSection(); ls.setItems(data); // Add the list section to a list view listView.sections = [ls]; listView.addEventListener('itemclick', function(e){ alert( "ItemId: " + e.itemId + "\n" + "BindId: " + e.bindId + "\n" + "Section Index: " + e.sectionIndex + ", Item Index: " + e.itemIndex ); }); var win = Ti.UI.createWindow({ backgroundColor: "white" }); win.add(listView); win.open();This regression is caused by [PR#4241](https://github.com/appcelerator/titanium_mobile/pull/4241).
Verified as fixed in my app by https://github.com/appcelerator/titanium_mobile/pull/4580 Thanks for the quick fix!
Closing as duplicate of linked ticket.