{ "id": "123964", "key": "TIMOB-16079", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "15972", "description": "Release 3.4.0", "name": "Release 3.4.0", "archived": false, "released": true, "releaseDate": "2014-09-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-08-20T00:58:36.000+0000", "created": "2013-12-18T08:58:25.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_listview", "qe-manualtest" ], "versions": [ { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "issuelinks": [ { "id": "34251", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "124705", "key": "AC-2278", "fields": { "summary": "ListView itemclick event itemIndex inconsistent between Android and iOS", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "updated": "2014-08-22T16:04:37.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h3. Steps to Reproduce\nCreate a SearchBar and ListView in Alloy, populate with searchable data. Enter search query in SearchBar and click top item. iOS returns the correct index of the clicked item, Android will return an index that is relative to the filtered list. i.e. the top item will always have an itemIndex of 0 on Android.\n\nh3. Actual Result\n0\n\nh3. Expected Result\nother than 0", "attachment": [ { "id": "44696", "filename": ".log", "author": { "name": "tartantangerine", "key": "tartantangerine", "displayName": "Tim Fisher", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-18T08:58:30.000+0000", "size": 2893559, "mimeType": "text/plain" }, { "id": "44697", "filename": "diagnostic3273972563179129461.log", "author": { "name": "tartantangerine", "key": "tartantangerine", "displayName": "Tim Fisher", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-18T08:58:34.000+0000", "size": 19033, "mimeType": "text/plain" } ], "flagged": false, "summary": "Android: Incorrect e.itemIndex for ListView and SearchBar", "creator": { "name": "tartantangerine", "key": "tartantangerine", "displayName": "Tim Fisher", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "tartantangerine", "key": "tartantangerine", "displayName": "Tim Fisher", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium Studio 3.2.0", "closedSprints": [ { "id": 105, "state": "closed", "name": "2014 Sprint 11 SDK", "startDate": "2014-05-27T21:43:32.338Z", "endDate": "2014-06-07T00:00:00.000Z", "completeDate": "2014-06-09T21:36:37.587Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "285546", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thank you, Tim, for reporting this issue. I would appreciate if you can provide a simple test case to reproduce the issue as that would help us in troubleshoot the issue.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-22T05:43:08.000+0000", "updated": "2013-12-22T05:43:08.000+0000" }, { "id": "286546", "author": { "name": "raybelisle", "key": "raybelisle", "displayName": "Ray Belisle", "active": true, "timeZone": "America/Edmonton" }, "body": "Here is an example that returns the correct item on iOS and shows the issue on Android.\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({backgroundColor: 'white', fullscreen: true});\r\n\r\nvar search = Titanium.UI.createSearchBar({\r\n barColor:'#000', \r\n showCancel:true,\r\n height:43,\r\n top:0,\r\n});\r\nsearch.addEventListener('cancel', function(){\r\n search.blur();\r\n});\r\n// for textSearch, use the change event to update the search value\r\n// search.addEventListener('change', function(e){\r\n// listView.searchText = e.value;\r\n// });\r\n\r\nvar listView = Ti.UI.createListView({searchView: search, caseInsensitiveSearch: true});\r\n// for textSearch, add the search bar or text field as a header view\r\n// var listView = Ti.UI.createListView({headerView: search, caseInsensitiveSearch: true});\r\n\r\nvar listSection = Ti.UI.createListSection();\r\nvar fruits = ['Papaya', 'Peach', 'Pear', 'Persimmon', 'Pineapple', 'Pluot', 'Pomegranate'];\r\nvar data = [];\r\nfor (var i = 0; i < fruits.length; i++) {\r\n data.push({\r\n properties: {title: fruits[i], searchableText: fruits[i]}\r\n });\r\n}\r\nlistSection.setItems(data);\r\n\r\nlistView.sections = [listSection];\r\n\r\nlistView.addEventListener('itemclick', function(e){\r\n // Only respond to clicks on the label (rowtitle) or image (pic)\r\nvar item = e.section.getItemAt(e.itemIndex);\r\nalert(item);\r\n});\r\nwin.add(listView);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-02T23:22:25.000+0000", "updated": "2014-02-12T17:15:30.000+0000" }, { "id": "289213", "author": { "name": "tartantangerine", "key": "tartantangerine", "displayName": "Tim Fisher", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Any idea when this will be fixed? I have an app going live at the end of Feb and this needs to be in.\r\n", "updateAuthor": { "name": "tartantangerine", "key": "tartantangerine", "displayName": "Tim Fisher", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-22T13:41:37.000+0000", "updated": "2014-01-22T13:41:37.000+0000" }, { "id": "297814", "author": { "name": "duy.nguyen", "key": "duy.nguyen", "displayName": "Nguyen Bao Duy", "active": true, "timeZone": "Asia/Jakarta" }, "body": "Hi guys,\r\nI have an app need to release at the end of this March. Can you guys fix it earlier? Or can explain me the reason of this issue and I can play around with it. Thanks so much", "updateAuthor": { "name": "duy.nguyen", "key": "duy.nguyen", "displayName": "Nguyen Bao Duy", "active": true, "timeZone": "Asia/Jakarta" }, "created": "2014-03-19T04:44:58.000+0000", "updated": "2014-03-19T04:44:58.000+0000" }, { "id": "297868", "author": { "name": "iaga84", "key": "iaga84", "displayName": "Alessio Iacarelli", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi All,\r\n\r\nSame issue here, is there any workaround available?\r\n\r\nThank you very much!", "updateAuthor": { "name": "iaga84", "key": "iaga84", "displayName": "Alessio Iacarelli", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-03-19T14:55:15.000+0000", "updated": "2014-03-19T14:55:15.000+0000" }, { "id": "298015", "author": { "name": "duy.nguyen", "key": "duy.nguyen", "displayName": "Nguyen Bao Duy", "active": true, "timeZone": "Asia/Jakarta" }, "body": "I did some trick and it working for me, I tested and found\"\r\ne.sectionIndex is right.\r\ne.itemIndex(wrong) is index of item in results list not original list.\r\n\r\nSo we can use _.filter() to get results manually from original list and SearchText(_results) and item we need will be _results[e.itemIndex].\r\n\r\nCode:\r\n{code}\r\nvar section = $.container.sections[e.sectionIndex];\r\n\r\nif (OS_ANDROID) {\r\n var key = $.container.getSearchText();\r\n \r\n // get results manually\r\n var _results = _.filter(section.items, function (_item) {\r\n return _item.properties.searchableText.indexOf(key) !== -1;\r\n });\r\n\r\n // item we need\r\n item = _results[e.itemIndex];\r\n}\r\n{code}\r\n", "updateAuthor": { "name": "duy.nguyen", "key": "duy.nguyen", "displayName": "Nguyen Bao Duy", "active": true, "timeZone": "Asia/Jakarta" }, "created": "2014-03-20T03:48:44.000+0000", "updated": "2014-03-20T03:52:33.000+0000" }, { "id": "301966", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Deferring to 3.4.0 to properly fix parity issue. Please let us know if the workaround does not work for you.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-04-21T21:52:33.000+0000", "updated": "2014-04-21T21:52:33.000+0000" }, { "id": "305928", "author": { "name": "mark.henderson@snagr.co.uk", "key": "mark.henderson@snagr.co.uk", "displayName": "Mark Henderson", "active": true, "timeZone": "Europe/London" }, "body": "Can I please champion this parity bug to be fixed as the work around is a lot of extra code.\r\n\r\nFor anyone not searching but filtering something like this will help:\r\n\r\n{code:Javascript}\r\n\r\nvar section = listView.sections[e.sectionIndex];\r\n\t\t\tvar key = listView.getSearchText();\r\n\t\t \t \t\r\n\t\t // get results manually - append itemIndex to e\r\n\t\t var item;\r\n\t\t if (key && key.length > 0) {\r\n\t\t\t for (var i=0; i < section.items.length; i++) {\r\n\t\t\t \t\tif (section.items[i].properties.searchableText.toLowerCase().indexOf(key) !== -1) {\r\n\t\t\t\t\t\tif (section.items[i].properties.itemId == e.itemId) {\r\n\t\t\t\t \t\t\titem = section.items[i];\r\n\t\t\t\t \t\t\te.itemIndex = i;\r\n\t\t\t\t \t\t\tbreak;\r\n\t\t\t\t \t\t}\t\r\n\t\t\t \t\t}\r\n\t\t\t\t};\r\n\t\t\t} else {\r\n\t\t\t\tfor (var i=0; i < section.items.length; i++) {\r\n\t\t\t\t\tif (section.items[i].properties.itemId == e.itemId) {\r\n\t\t\t\t\t\titem = section.items[i];\r\n\t\t\t\t \t\te.itemIndex = i;\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (item && e.itemIndex) {\r\n\t\t\t\tif (item.properties.accessoryType == Ti.UI.LIST_ACCESSORY_TYPE_CHECKMARK) {\r\n\t\t\t\t\titem.properties.accessoryType = Ti.UI.LIST_ACCESSORY_TYPE_NONE;\r\n\t\t\t\t} else {\r\n\t\t\t\t\titem.properties.accessoryType = Ti.UI.LIST_ACCESSORY_TYPE_CHECKMARK;\r\n\t\t\t\t}\r\n\t\t\t \r\n\t\t\t e.section.updateItemAt(e.itemIndex,item);\r\n\t\t\t}\r\n{code}", "updateAuthor": { "name": "mark.henderson@snagr.co.uk", "key": "mark.henderson@snagr.co.uk", "displayName": "Mark Henderson", "active": true, "timeZone": "Europe/London" }, "created": "2014-05-21T15:51:51.000+0000", "updated": "2014-05-21T16:09:39.000+0000" }, { "id": "307325", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Modfied the code to store real index instead of the filtered index in the event data\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/pull/5755", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-06-03T13:39:46.000+0000", "updated": "2014-06-03T13:39:46.000+0000" }, { "id": "319391", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix.\r\nAndroid returns the right e.itemIndex & not just of the first item.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 3.4.0.201408180158\r\nTi SDK : 3.4.0.v20140815142514\r\nMac OSX : 10.8.5\r\nAlloy : 1.5.0-dev\r\nCLI - 3.4.0-dev\r\nCode Processor: 1.1.1\r\nNexus 5 - android 4.4.4", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-20T00:57:52.000+0000", "updated": "2014-08-20T00:58:06.000+0000" }, { "id": "319907", "author": { "name": "ndastur", "key": "ndastur", "displayName": "Neville Dastur", "active": true, "timeZone": "Europe/London" }, "body": "Due for release in 3.4.0. REALLY!!!?\r\n\r\nThis is quite a critical bug and I would ask for it to be part of a maintainance release please", "updateAuthor": { "name": "ndastur", "key": "ndastur", "displayName": "Neville Dastur", "active": true, "timeZone": "Europe/London" }, "created": "2014-08-22T13:04:19.000+0000", "updated": "2014-08-22T13:04:19.000+0000" }, { "id": "319931", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-22T16:02:19.000+0000", "updated": "2014-08-22T16:02:19.000+0000" }, { "id": "319932", "author": { "name": "ndastur", "key": "ndastur", "displayName": "Neville Dastur", "active": true, "timeZone": "Europe/London" }, "body": "Oh, okay. I saw the PR was 3 months old and having just released 3.3.0.GA I thought 3.4.0 was going to be a while off.", "updateAuthor": { "name": "ndastur", "key": "ndastur", "displayName": "Neville Dastur", "active": true, "timeZone": "Europe/London" }, "created": "2014-08-22T16:04:37.000+0000", "updated": "2014-08-22T16:04:37.000+0000" } ], "maxResults": 17, "total": 17, "startAt": 0 } } }