{ "id": "130886", "key": "TIMOB-17028", "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": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2014-06-30T18:20:36.000+0000", "created": "2014-05-26T19:39:40.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "supportTeam" ], "versions": [ { "id": "15857", "description": "Release 3.2.2", "name": "Release 3.2.2", "archived": false, "released": true, "releaseDate": "2014-03-09" }, { "id": "15971", "description": "Release 3.2.3", "name": "Release 3.2.3", "archived": false, "released": true, "releaseDate": "2014-04-30" } ], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-22T21:47:48.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": [], "description": "h3. Issue\r\n\r\nIn iOS when using the property \"canEdit:true\" in a template and deleting a row to catch the \"delete event\" the data received is from the listView state after the user action, even when the documentation mention that this information will return the data from before the user action.\r\n\r\n\"Note that the sectionIndex and itemIndex properties of this event correspond to the List View state before the user action.\"\r\n\r\nh3. Steps to repro\r\n\r\n1. Open the test case\r\n2. Swipe on any of the rows\r\n3. Click the delete button\r\n\r\nExpected Result:\r\n\r\nThe alert will show the information of the row that has been deleted.\r\n\r\nActual Result:\r\n\r\nThe alert shows the information form the row that takes the position of the deleted row.\r\n\r\nh3. Sample Code\r\n\r\n{code}\r\nvar aWindow = Ti.UI.createWindow({\r\n\ttitle : \"ListView Delete\",\r\n\tbackgroundColor : 'white'\r\n});\r\nvar itemTemplate = {\r\n\tchildTemplates : [{\r\n\t\ttype : 'Ti.UI.Label',\r\n\t\tbindId : 'lblText',\r\n\t\tproperties : {\r\n\t\t\ttop : 20,\r\n\t\t\tbottom : 20,\r\n\t\t\tcolor : 'black',\r\n\t\t\twidth : Ti.UI.SIZE,\r\n\t\t\theight : Ti.UI.SIZE\r\n\t\t}\r\n\t}]\r\n};\r\n\r\nvar listItems = [];\r\nfor (var i = 0; i < 20; i++) {\r\n\tlistItems.push({\r\n\t\tlblText : {\r\n\t\t\ttext : i + ' samll'\r\n\t\t},\r\n\t\tproperties : {\r\n\t\t\tid : i,\r\n\t\t\tbackgroundColor : 'white',\r\n\t\t\tcanEdit : true,\r\n\t\t\theight : Ti.UI.SIZE,\r\n\t\t\tselectedBackgroundColor : 'gray'\r\n\t\t}\r\n\t});\r\n\r\n}\r\nvar listSection = Ti.UI.createListSection({\r\n\titems : listItems\r\n});\r\nvar listView = Ti.UI.createListView({\r\n\ttemplates : {\r\n\t\t'itemTemp' : itemTemplate\r\n\t},\r\n\tdefaultItemTemplate : 'itemTemp',\r\n\tsections : [listSection]\r\n});\r\n\r\nlistView.addEventListener('delete', itemDelete);\r\n\r\nfunction itemDelete(e) {\r\n\talert(\"itemDetails>>\" + JSON.stringify(e.section.getItemAt(e.itemIndex)));\r\n}\r\n\r\naWindow.add(listView);\r\naWindow.open();\r\n{code}\r\n\r\nh3. Documentation\r\nhttp://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.ListView-event-delete", "attachment": [], "flagged": false, "summary": "iOS: ListView delete event returning incorrect data", "creator": { "name": "mcota", "key": "mcota", "displayName": "Marco Cota", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mcota", "key": "mcota", "displayName": "Marco Cota", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 133, "state": "closed", "name": "2014 Sprint 13 SDK", "startDate": "2014-06-23T21:55:20.791Z", "endDate": "2014-07-04T00:00:00.000Z", "completeDate": "2014-07-07T17:32:18.561Z", "originBoardId": 100 } ], "comment": { "comments": [ { "id": "311658", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "The documentation is correct. The sectionIndex and itemIndex do correspond to listview state before the user action. There is no sectionIndex or itemIndex for the item after it has been deleted from the listview. \r\n\r\nThe two properties are sent out for the developer to update their data set on the javascript side. Listview automatically updates its internal data set on delete event. Querying the listview or section for deleted data is incorrect.", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-06-30T18:20:36.000+0000", "updated": "2014-06-30T18:20:36.000+0000" }, { "id": "315344", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Still existing in 3.3.GA and making delete-events impossible.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-07-22T21:09:08.000+0000", "updated": "2014-07-22T21:09:08.000+0000" }, { "id": "315381", "author": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hans, try to use itemId to determine which item is being deleted INSTEAD OF using itemIndex", "updateAuthor": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-07-22T23:08:08.000+0000", "updated": "2014-07-22T23:08:08.000+0000" }, { "id": "316217", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thank you, solved for me!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-07-29T22:19:53.000+0000", "updated": "2014-07-29T22:19:53.000+0000" }, { "id": "415041", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid with reference to previous comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T21:47:48.000+0000", "updated": "2017-03-22T21:47:48.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }