{ "id": "154789", "key": "TIMOB-20389", "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": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-02-15T05:31:22.000+0000", "created": "2016-02-07T20:31:40.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "listview", "regression" ], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-02-17T22:56:46.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": "In TiUIListView.m code has been refactored a couple of months ago (?) to fire edit events in 1 place. For delete this is causing quite a big problem because now the order of events has changed.\r\n\r\nTiUIListView.m, around line 1045\r\n- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath\r\n\r\n\r\nBefore the change:\r\n- A reference to the deleted item was stored\r\n- The actual delete was performed on the listview\r\n- The event for the JS client was build and sent using the previously stored itemId\r\n\r\nAfter the change:\r\n- The item is actually deleted from the listview.\r\n- The fireEditEventWithName method is called to trigger the JS event.\r\n\r\nThe problem:\r\nThe fireEditEventWithName gets a reference to the item (and thus the itemId) at a section index and itemindex, but since the item was already deleted it gets the wrong or no item.\r\n\r\nIf my findings are correct you have created quite a big invisible bug deleting wrong items all over the world...\r\n\r\n{code:title=Sample.JavaScript|borderStyle=solid}\r\n//FirstView Component Constructor\r\nfunction FirstView() {\r\n\t//create object instance, a parasitic subclass of Observable\r\n\tvar self = Ti.UI.createView();\r\n\r\n\tvar listView = Ti.UI.createListView({\r\n\t\tediting: true,\r\n\t\tallowsSelection: true\r\n\t});\r\n\tvar sections = [];\r\n\t\r\n\tvar fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});\r\n\tvar fruitDataSet = [\r\n\t {properties: { itemId: \"apple\", title: 'Apple', canEdit: true}},\r\n\t {properties: { itemId: \"banana\", title: 'Banana', canEdit: true}},\r\n\t];\r\n\tfruitSection.setItems(fruitDataSet);\r\n\tsections.push(fruitSection);\r\n\t\r\n\tvar vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables'});\r\n\tvar vegDataSet = [\r\n\t {properties: { itemId: \"carrots\", title: 'Carrots', canEdit: true}},\r\n\t {properties: { itemId: \"potatoes\", title: 'Potatoes', canEdit: true}},\r\n\t];\r\n\tvegSection.setItems(vegDataSet);\r\n\tsections.push(vegSection);\r\n\t\r\n\tlistView.sections = sections;\r\n\tself.add(listView);\r\n\t\r\n\tvar fishSection = Ti.UI.createListSection({ headerTitle: 'Fish'});\r\n\tvar fishDataSet = [\r\n\t {properties: { itemId: \"cod\", title: 'Cod', canEdit: true}},\r\n\t {properties: { itemId: \"haddock\", title: 'Haddock', canEdit: true}},\r\n\t];\r\n\tfishSection.setItems(fishDataSet);\r\n\tlistView.appendSection(fishSection);\r\n\t\r\n\tlistView.addEventListener(\"delete\", function(e) {\r\n\t\talert(e.itemId);\r\n\t});\r\n\r\n\treturn self;\r\n}\r\n\r\nmodule.exports = FirstView;\r\n{code}", "attachment": [ { "id": "58201", "filename": "Screen Shot 2016-02-11 at 3.12.50 PM.png", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-11T09:15:03.000+0000", "size": 34336, "mimeType": "image/png" }, { "id": "58200", "filename": "Screen Shot 2016-02-11 at 3.13.05 PM.png", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-11T09:15:10.000+0000", "size": 36650, "mimeType": "image/png" }, { "id": "58199", "filename": "Screen Shot 2016-02-11 at 3.13.36 PM.png", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-11T09:15:18.000+0000", "size": 35518, "mimeType": "image/png" }, { "id": "58198", "filename": "Screen Shot 2016-02-11 at 3.13.50 PM.png", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-11T09:15:25.000+0000", "size": 38800, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: Listview delete event sends wrong itemId", "creator": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 580, "state": "closed", "name": "2016 Sprint 3 SDK", "startDate": "2016-01-30T01:31:48.991Z", "endDate": "2016-02-13T01:31:00.000Z", "completeDate": "2016-02-15T05:32:40.725Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "376320", "author": { "name": "jnaher", "key": "jnaher", "displayName": "Jebun Naher", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello,\r\n\r\nThanks for sharing your findings. It would be much helpful if you can attach any test code that shows this behavior.\r\n\r\nThanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-09T11:07:43.000+0000", "updated": "2016-02-09T11:16:26.000+0000" }, { "id": "376509", "author": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "body": "Added a JS sample. Just delete any item and the alert will either show no item Id at all, or even worse the wrong item Id.\r\n\r\nIMHO certain bugs are worth looking into without waiting for a user sample... Not sure how many users have implemented this of course, but seems pretty critical to me. I am just \"lucky\" that I had not updated my app in a while.", "updateAuthor": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-10T09:33:42.000+0000", "updated": "2016-02-10T09:33:42.000+0000" }, { "id": "376603", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I tried your sample code for test, I did not found the problem. Deleting an item shows the alert of right item id. See the attachments. First screen shot shows the listview. Second one shows the alert 'apple' when I delete item 'apple'. Third one shows the alert 'carrots' when I delete item 'carrots'. And the last one shows 'haddock' when I delete 'haddock' item. I tested with SDK 5.1.2.GA. \r\n\r\nAlso IMHO, It is always better to provide sample code of an issue. It helps clearly understanding the customer problem which leads to faster customer support. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-11T09:23:13.000+0000", "updated": "2016-02-11T09:23:13.000+0000" }, { "id": "376604", "author": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "body": "Terribly sorry, forgot to mention that I was working using bleeding edge...\r\n\r\nAppears to have been introduced in the 5.2.x branche. The change was introduced in the commit for \"[TIMOB-7735] Support UITableView insert style\" on Oct. 27\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/commit/567e29a54280a21c4504b2f29ec718b592835436", "updateAuthor": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-11T09:30:01.000+0000", "updated": "2016-02-11T09:30:01.000+0000" }, { "id": "376605", "author": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "body": "Since 5.2.x has not yet been released this of course isn't as huge an issue as I stated earlier... It's quite a terrible and invisible bug (no unit tests on this?), but it does not yet apply to live client applications (except for people like me who tend to prefer nightly builds...)", "updateAuthor": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-11T09:36:25.000+0000", "updated": "2016-02-11T09:36:25.000+0000" }, { "id": "376606", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Please update to latest SDK 5.1.2.GA. Closing this issue. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-11T09:40:02.000+0000", "updated": "2016-02-11T09:40:55.000+0000" }, { "id": "376607", "author": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "body": "NOOOOO! Don't close it! I mean... The bug causing code has been introduced almost 4 months ago an no one noticed it. Not sure if you have placed the issue on a different list, but it needs to be fixed before you release 5.2.x right???", "updateAuthor": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-11T09:44:03.000+0000", "updated": "2016-02-11T09:44:03.000+0000" }, { "id": "376608", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "The issue is not occurring in SDK 5.1.2.GA. Update your SDK 5.1.2.GA. Download [link|http://builds.appcelerator.com.s3.amazonaws.com/index.html#5_1_X]. Also 5.2.x beta is available. ", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-11T09:49:27.000+0000", "updated": "2016-02-11T09:49:55.000+0000" }, { "id": "376609", "author": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "body": "1. I understand that this is not in the 5.1.2.\r\n2. I am worried that if you close this issue, no-one will fix it before 5.2.x is released. 5.2.x DOES contain this issue.", "updateAuthor": { "name": "martijnkooij", "key": "martijnkooij", "displayName": "Martijn Kooij", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-11T10:00:30.000+0000", "updated": "2016-02-11T10:00:30.000+0000" }, { "id": "376610", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I have tested this in SDK 5.2.0.v20160114021251. The issue occurs. Moving the ticket for father processing. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-02-11T10:17:03.000+0000", "updated": "2016-02-11T10:17:03.000+0000" }, { "id": "376724", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi [~martijnkooij], I'm very thankful for you to discover this issue! It' definitely critical and your code analysis is correct. The problem is, that we now received the itemId after the cell was deleted so it's the wrong one. I'll setup a fix right now and we will patch the 5.2.x asap!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-12T12:26:51.000+0000", "updated": "2016-02-12T12:26:51.000+0000" }, { "id": "376726", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/7713\r\nPR (5_2_X): https://github.com/appcelerator/titanium_mobile/pull/7714", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-12T12:36:39.000+0000", "updated": "2016-02-12T12:36:39.000+0000" }, { "id": "377150", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\n\r\nMacOS 10.11.3 (15D21)\r\nStudio 4.5.0.201602170821\r\nTi SDK 5.2.0.v20160216202526\r\nAppc NPM 4.2.3-2\r\nAppc CLI 5.2.0-265\r\nAlloy 1.7.33\r\nXcode 7.2 (7C68)\r\n\r\nDeleting an item from a listview returns the correct itemid. Tested using the provided code.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-02-17T22:56:46.000+0000", "updated": "2016-02-17T22:56:46.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }