{ "id": "83454", "key": "TIMOB-7030", "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": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "13170", "name": "Sprint 2012-06", "archived": true, "released": true, "releaseDate": "2012-03-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-04-02T20:14:29.000+0000", "created": "2011-12-07T06:25:34.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_tableview", "qe-testadded" ], "versions": [ { "id": "11233", "name": "Release 1.6.0", "archived": true, "released": true, "releaseDate": "2011-02-23" } ], "issuelinks": [ { "id": "22695", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "104643", "key": "TIMOB-11688", "fields": { "summary": "iOS: TableView - Click on chosen row returns all table view rows", "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" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-11-07T18:33:43.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h2. Problem\r\n\r\nTableView click event has wrong data when you are current running a seach and then click the detail button. If you do a search in TableView and click the detail button of the first search result it will give you the rowData from the first row when there is no search. If you tap the row itself it gives you the correct data. I have tracked this down to TiUITableView.m (see patch below).\r\n\r\nh2. Test Case\r\n\r\nTableTest.zip:\r\n\r\nIncluded a full demo app that shows the problem in action. Instructions for running:\r\n# Run in iPhone simulator\r\n# Click a table row detail button to show it by default shows the correct values\r\n# Type \"third\" in the search bar for the table view\r\n# Click the table row detail button to show that when searching it shows the wrong data when searching\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar tabGroup = Ti.UI.createTabGroup();\r\nvar win = Ti.UI.createWindow({});\r\nvar tab = Ti.UI.createTab({\r\n title: 'Table Test',\r\n window: win\r\n});\r\n\r\nvar data = [\r\n {title: 'First Row', hasDetail: true},\r\n {title: 'Second Row', hasDetail: true},\r\n {title: 'Third Row', hasDetail: true},\r\n {title: 'Forth Row', hasDetail: true},\r\n {title: 'Fifth Row', hasDetail: true}\r\n];\r\n\r\nvar search = Ti.UI.createSearchBar({\r\n returnKeyType: Ti.UI.RETURNKEY_DONE\r\n});\r\n\r\nvar tableView = Ti.UI.createTableView({\r\n data: data,\r\n search: search\r\n});\r\n\r\ntableView.addEventListener('click', function (e) {\r\n alert('Click Event. index: ' + e.index + ', Title: ' + e.row.title);\r\n});\r\nwin.add(tableView);\r\ntabGroup.addTab(tab);\r\ntabGroup.open();\r\n{code}\r\n\r\nh2. Solution\r\n\r\n{code:lang=none|title=TiUITableView.m}\r\n- (void)tableView:(UITableView *)ourTableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath\r\n{\r\n\tBOOL search = NO;\r\n\tif (allowsSelectionSet==NO || [ourTableView allowsSelection]==NO)\r\n\t{\r\n\t\t[ourTableView deselectRowAtIndexPath:indexPath animated:YES];\r\n\t}\r\n\tif(ourTableView != tableview)\r\n\t{\r\n\t\tsearch = YES;\r\n\t}\r\n\t[self triggerActionForIndexPath:indexPath fromPath:nil tableView:ourTableView wasAccessory:YES search:search name:@\"click\"];\r\n}\r\n{code}\r\n\r\nh2. Logs\r\n\r\nSee attached build log\r\n", "attachment": [ { "id": "24970", "filename": "build.log", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-08T15:51:27.000+0000", "size": 1068547, "mimeType": "text/plain" }, { "id": "24969", "filename": "TableTest.zip", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-08T15:39:27.000+0000", "size": 2319864, "mimeType": "application/zip" }, { "id": "24971", "filename": "TiUITableView.m", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-08T15:51:27.000+0000", "size": 66407, "mimeType": "application/octet-stream" } ], "flagged": false, "summary": "iOS: TableView - click event contains incorrect data when searchbar filter active", "creator": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "environment": "* Titanium SDK version: 1.6.0, 1.7.0, 1.8.0.1\r\n* iOS 4.0, 5.0", "comment": { "comments": [ { "id": "175158", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "body": "When you click accessory buttons when you're running a search on a table view, the wrong row data is passed to the click event. This is because unlike the main click delegate (didSelectRowAtIndexPath) it does not take into account that a search is currently being run.\r\n\r\nThis has been around since at least 1.4.0 or so, maybe even earlier. I keep changing my local code in ever new version of Titanium that is released. Its a few line fix so would be really good if it was fixed in the Titanium master code.\r\n\r\nI've filled in a pull request here: https://github.com/appcelerator/titanium_mobile/pull/866\r\n\r\nI also filled in the form for contributing to the Titanium project quite a while a go with my github id jamesdlow", "updateAuthor": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-07T06:36:29.000+0000", "updated": "2011-12-07T06:36:29.000+0000" }, { "id": "175159", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "body": "I'm also actually a paying titanium member, but jira wouldn't let me raised this against the TIMOB project directly.", "updateAuthor": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-07T06:39:18.000+0000", "updated": "2011-12-07T06:39:18.000+0000" }, { "id": "177370", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "James\r\n\r\nThanks for raising this ticket, and for your efforts in creating a patch.\r\n\r\nIn order for me to escalate it to the core team, however, and also accept the Pull Request, all the fields in this ticket must be complete. Please check it against the [JIRA Ticket Checklist|https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist], and add any missing information.\r\n\r\nFurthermore, a simple test case must be included and run without modification, as per the [Creating a Test Case|https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-CreatingaTestCase] section.\r\n\r\nI will mark this resolved for now. Please reopen it once it is complete, and I will move it to the main project.\r\n\r\nCheers", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-28T05:09:39.000+0000", "updated": "2011-12-28T05:09:39.000+0000" }, { "id": "178470", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "body": "Hi,\r\nI've updated with the requested info.\r\n\r\nThanks,\r\nJames", "updateAuthor": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-08T15:52:28.000+0000", "updated": "2012-01-08T15:52:28.000+0000" }, { "id": "178471", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Thank you very much for this, James, I'm moving it across.\r\n", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-08T16:56:44.000+0000", "updated": "2012-01-08T16:56:44.000+0000" }, { "id": "178472", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Apologies, would you complete the environment field, and then I will definitely be able to move it! ;)\r\nMost importantly, what version of ios have you seen this issue with, and have you tested in the simulator, and/or seen it on a device?\r\n\r\nThanks", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-08T16:59:13.000+0000", "updated": "2012-01-08T16:59:13.000+0000" }, { "id": "178474", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "body": "Hi Paul, Updated with the relevant information. It has basically affected all version of Titanium/iOS since I've started using it.", "updateAuthor": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-08T17:57:18.000+0000", "updated": "2012-01-08T17:57:18.000+0000" }, { "id": "178496", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Thanks, James. I will move it over but, for completeness, I was hoping for the device that you have tested it on. If that's just the simulator, would you state that?\r\n\r\nThanks", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-09T08:07:47.000+0000", "updated": "2012-01-09T08:07:47.000+0000" }, { "id": "178540", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "body": "Oh its not just the simulator. On my app that I've implemented a fix for its run the most on iOS 4.3 and 5.0 and mainly using Titanium 1.7.3, but I've been manually updating TiUITableView.m with this fix every time a new SDK is released at least since 1.6.0.", "updateAuthor": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-09T12:38:00.000+0000", "updated": "2012-01-09T12:38:00.000+0000" }, { "id": "178541", "author": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "body": "Oh its not just the simulator. On my app that I've implemented a fix for its run the most on iOS 4.3 and 5.0 and mainly using Titanium 1.7.3, but I've been manually updating TiUITableView.m with this fix every time a new SDK is released at least since 1.6.0.", "updateAuthor": { "name": "jamesdlow", "key": "jamesdlow", "displayName": "James David Low", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-09T12:38:00.000+0000", "updated": "2012-01-09T12:38:00.000+0000" }, { "id": "186105", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Assigning to Blain, as he is in charge of processing the pull request.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-12T15:20:43.000+0000", "updated": "2012-03-12T15:20:43.000+0000" }, { "id": "186106", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Community pull #866 processed. Credit to James Low.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-12T15:22:49.000+0000", "updated": "2012-03-12T15:22:49.000+0000" }, { "id": "186651", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing bug. Verified fix on:\r\n\r\nSDK build: 2.0.0.v20120315123246\r\nTitanium Studio, build: 2.0.0.201203142055\r\nxcode: 4.2\r\nDevice: iphone 4s (5.0.1)", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-03-15T12:22:20.000+0000", "updated": "2012-03-15T12:22:20.000+0000" }, { "id": "189572", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reopening/closing to add/remove labels", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-02T15:20:50.000+0000", "updated": "2012-04-02T15:20:50.000+0000" } ], "maxResults": 14, "total": 14, "startAt": 0 } } }