Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14902] Android: ListView itemclick event broken in 3.1.2.GA

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2013-08-17T01:34:57.000+0000
Affected Version/sRelease 3.1.2
Fix Version/s2013 Sprint 17, 2013 Sprint 17 API, Release 3.1.3, Release 3.2.0
ComponentsAndroid
Labels3.1.2, android, listview, qe-testadded, regression
ReporterMark Mokryn
AssigneePing Wang
Created2013-08-16T21:54:40.000+0000
Updated2014-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();

Comments

  1. Mark Mokryn 2013-08-16

  2. Eric Merriman 2013-08-16

    Linking to a TIMOB ticket. TIMOB-14901
  3. Ping Wang 2013-08-16

    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();
       
  4. Ping Wang 2013-08-16

    This regression is caused by [PR#4241](https://github.com/appcelerator/titanium_mobile/pull/4241).
  5. Mark Mokryn 2013-08-17

    Verified as fixed in my app by https://github.com/appcelerator/titanium_mobile/pull/4580 Thanks for the quick fix!
  6. Eric Merriman 2013-08-22

    Closing as duplicate of linked ticket.

JSON Source