Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13141] Android: ListView itemclick event does not fire when clicking on the accessory

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-03-27T01:33:14.000+0000
Affected Version/sRelease 3.1.0
Fix Version/sRelease 3.1.0, 2013 Sprint 07 API, 2013 Sprint 07
ComponentsAndroid
Labelslistview, qe-testadded, triage
ReporterBenjamin Hatfield
AssigneeHieu Pham
Created2013-03-20T21:36:57.000+0000
Updated2013-09-20T09:32:01.000+0000

Description

Run the following code below in the Android emulator. Click on the accessories (checkmark, detail button, disclosure indicator). The itemclick event does not fire. Click anywhere else on the cell. The itemclick event fires. EXPECTED BEHAVIOR: itemclick should still fire when clicking on the accessory.
var win = Ti.UI.createWindow({backgroundColor: 'white'});
var listView = Ti.UI.createListView();

var tasks = [
    {id: 'trash', name: 'Take Out the Trash', icon: 'KS_nav_views.png', accessory: Ti.UI.LIST_ACCESSORY_TYPE_DETAIL},
    {id: 'dishes', name: 'Do the Dishes', icon: 'KS_nav_views.png', accessory: Ti.UI.LIST_ACCESSORY_TYPE_DISCLOSURE},
    {id: 'doggie', name: 'Walk the Dog', icon: 'KS_nav_views.png', accessory: Ti.UI.LIST_ACCESSORY_TYPE_CHECKMARK}
];

var data = [];
for (var i = 0; i < tasks.length; i++) {
    data.push(
        { properties: {
            itemId: tasks[i].id,
            title: tasks[i].name,
            image: tasks[i].icon,
            accessoryType: tasks[i].accessory,
            color: 'black'
        }
    });
}

var section = Ti.UI.createListSection();
section.setItems(data);
listView.sections = [section];
listView.addEventListener('itemclick', function(e){
	Ti.API.info(JSON.stringify(e));
});
win.add(listView);
win.open();

Comments

  1. Ping Wang 2013-03-26

    PR: https://github.com/appcelerator/titanium_mobile/pull/4033
  2. Paras Mishra 2013-04-10

    Closing as working fine. Verified on: Device : Google Nexus 7, Android Version: 4.1 SDK: 3.1.0.v20130409124549 CLI version : 3.1.0-cr OS : MAC OSX 10.7.5 Appcelerator Studio, build: 3.1.0.201304052347 XCode : 4.5.1

JSON Source