{ "id": "123027", "key": "TIMOB-15932", "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": "15922", "description": "2014 Sprint 03", "name": "2014 Sprint 03", "archived": true, "released": true, "releaseDate": "2014-02-14" }, { "id": "15923", "description": "2014 Sprint 03 API", "name": "2014 Sprint 03 API", "archived": true, "released": true, "releaseDate": "2014-02-14" }, { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-02-05T18:18:04.000+0000", "created": "2013-11-28T08:19:11.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "deleteRow", "editable", "index", "ios", "module_tableview", "qe-closed-3.3.0", "qe-testadded", "swipe", "tableview", "triage" ], "versions": [], "issuelinks": [], "assignee": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-08-01T04:31:07.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": "The following tableview displays 20 numbered rows. The tableview is set as \"editable:true\", so the swipe-to-delete gesture is enabled in iOS. The tableview also has a click event handler, so any row clicked on, will be deleted as well with the TableView.deleteRow() method. The idea is that a user can swipe-to-delete any row, or simply click any row to delete it.\r\n\r\nProblem: Swipe-deleting a row, then calling .deleteRow() on a later row causes the display to remove the incorrect row. Seems like Swipe-to-delete is causing an indexing problem with the rows.\r\n\r\nFor example;\r\n\r\n1. Load the app.\r\n\r\n2. Click on \"Row 1\" to delete it. This works fine.\r\n\r\n3. Swipe-to-delete \"Row 2\" and delete it. This works fine.\r\n\r\n3. Click on \"Row 3\" to delete it. This fails, and \"Row 4\" gets deleted instead of \"Row 3\".\r\n\r\nAnytime you swipe-delete a row, any other rows below that one which are deleted with TableView.deleteRow() miss the correct index, instead deleting something farther below their index. \r\n\r\nThe more swipe-deletes you do, the more the index is offset incorrectly when calling .deleteRow().\r\n\r\nUsing $.tv.deleteRow(e.index) or $.tv.deleteRow(e.row) does not make a difference.\r\n\r\nHere's the code:\r\n\r\nindex.xml:\r\n{code:xml}\r\n\r\n \r\n \r\n \t\r\n \r\n \r\n \r\n\t\r\n{code}\r\n\r\nindex.js:\r\n{code}\r\nvar tableData = [];\r\n\r\nfor (var i=1; i<21; i++) {\r\n tableData.push({ title: 'Row ' + i });\r\n}\r\n\r\n$.tv.setData(tableData);\r\n$.index.open();\r\n\r\nfunction tv_onClick(e) {\t\r\n $.tv.deleteRow(e.index);\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Editable TableView loses correct index when using swipe-delete gesture then .deleteRow()", "creator": { "name": "bcproductions", "key": "bcproductions", "displayName": "Ed", "active": true, "timeZone": "America/Havana" }, "subtasks": [], "reporter": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "iOS Simulator\r\nTi SDK v3.1.3GA\r\nAlloy", "comment": { "comments": [ { "id": "283293", "author": { "name": "bcproductions", "key": "bcproductions", "displayName": "Ed", "active": true, "timeZone": "America/Havana" }, "body": "I see this has been assigned to Alloy, but this is not an Alloy issue. The same problem can be reproduced under Classic Ti.\r\n\r\nCreate a new classic project, with the 'Single Window Application' template, and replace the code in /common/FirstView.js for the code below. Test deleting by swiping and clicking as shown above.\r\n\r\n{code}\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\t\r\n\tvar tv = Ti.UI.createTableView({\r\n\t\teditable: true\r\n\t});\r\n\t\r\n\tself.add(tv);\r\n\t\r\n\ttv.addEventListener('click', function(e) {\r\n\t\ttv.deleteRow(e.index);\r\n\t});\r\n\t\r\n\tvar tableData = [];\r\n \r\n\tfor (var i=1; i<21; i++) {\r\n \t\ttableData.push({ title: 'Row ' + i });\r\n\t}\r\n \r\n\ttv.setData(tableData);\r\n\t\r\n\treturn self;\r\n}\r\n\r\nmodule.exports = FirstView;\r\n{code} ", "updateAuthor": { "name": "bcproductions", "key": "bcproductions", "displayName": "Ed", "active": true, "timeZone": "America/Havana" }, "created": "2013-12-09T21:09:44.000+0000", "updated": "2013-12-09T21:09:44.000+0000" }, { "id": "291121", "author": { "name": "bcproductions", "key": "bcproductions", "displayName": "Ed", "active": true, "timeZone": "America/Havana" }, "body": "I know this has not been fixed, but any timeline for a fix or a workaround? This bug breaks the tableview functionality. ", "updateAuthor": { "name": "bcproductions", "key": "bcproductions", "displayName": "Ed", "active": true, "timeZone": "America/Havana" }, "created": "2014-02-04T14:49:59.000+0000", "updated": "2014-02-04T14:49:59.000+0000" }, { "id": "291207", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master PR : https://github.com/appcelerator/titanium_mobile/pull/5319", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-04T21:10:06.000+0000", "updated": "2014-02-04T21:10:06.000+0000" }, { "id": "291442", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "CR + FR", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-02-05T18:18:04.000+0000", "updated": "2014-02-05T18:18:04.000+0000" }, { "id": "302665", "author": { "name": "nmittal", "key": "nmittal", "displayName": "Neha Mittal", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Verified fix with below environment:\r\n\r\nAppc Studio: 3.3.0.201404251359\r\nSDK build: 3.3.0.v20140425191906\r\nacs: 1.0.14\r\nnpm: 1.3.2\r\nalloy: 1.4.0-dev\r\nCLI: titanium-3.3.0-dev\r\ntitanium-code-processor:1.1.1-beta1\r\nXcode: 5.1.1\r\nOsx: Mavericks(10.9.2)\r\nDevice: iPhone 5 (7.1)\r\n\r\nNow swipe-to-delete is causing correct indexing with the rows. Verified with the alloy code provided in the description. Hence closing the issue.\r\n", "updateAuthor": { "name": "nmittal", "key": "nmittal", "displayName": "Neha Mittal", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-04-28T06:17:43.000+0000", "updated": "2014-04-28T06:17:43.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }