{ "id": "89137", "key": "TIMOB-8411", "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": "2012-04-03T14:14:46.000+0000", "created": "2012-03-29T09:21:12.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "13070", "description": "Release 1.8 Service Pack 2", "name": "Release 1.8.2", "archived": true, "released": true, "releaseDate": "2012-02-29" } ], "issuelinks": [ { "id": "17215", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "91713", "key": "TIDOC-620", "fields": { "summary": "APIDOC: Android UI.TableView - swipe event supported on Ti 2.1 and above", "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": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-23T21:37:47.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": "*Code*\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: 'white'\r\n});\r\n\r\nvar table = Ti.UI.createTableView();\r\nvar data = [];\r\n\r\nfor (var i = 0; i < 20; i++)\r\n{\r\n\tvar row = Ti.UI.createTableViewRow({\r\n\t\tmyRowID: i\r\n\t});\r\n\t\r\n\tvar label = Ti.UI.createLabel({\r\n\t\ttext: i,\r\n\t\tleft: 0,\r\n\t\twidth: 'auto'\r\n\t});\r\n\t\r\n\trow.add(label);\r\n\tdata.push(row);\r\n}\r\n\r\ntable.setData(data);\r\n\r\ntable.addEventListener('swipe', function(e)\r\n{\r\n\tvar row = e.source;\r\n\t\r\n\tif (!row)\r\n\t\treturn;\r\n\t\t\r\n\tTi.API.info('Row swiped: ' + row);\r\n\tTi.API.info('Row ID : ' + row.myRowID);\r\n});\r\n\r\nwin.add(table);\r\nwin.open();\r\n{code}\r\n\r\n*Expected behavior*\r\nWhen you swipe on a row, e.source should return the correct Ti.UI.TableViewRow object and the ID of the row should be printed out in the console.\r\n\r\n*Actual behavior*\r\nEvery time you swipe on a row, e.source actually returns the Ti.UI.TableView object itself, not the specific row.\r\n\r\n*Notes*\r\n-If you change 'swipe' to 'click' event, you will see that it prints out the correct values and has the correct behavior. \r\n-Only tested on iOS 5 simulator, with TiSDK 1.8.2", "attachment": [], "flagged": false, "summary": "iOS: Ti.UI.TableView swipe event e.source doesn't return the correct object", "creator": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "environment": "Titanium SDK version: 1.8.2\r\nPlatform & version: iOS 5.0 simulator \r\nHost Operating System: OSX 10.7.2\r\nTitanium Studio version: 1.0.9.201202141208", "comment": { "comments": [ { "id": "189194", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Swipe is a gesture and not a touch event like click. Gesture recognizers are not registered unless you add an event handler. Since the swipe event handler was added to the table, the table is the only one generating the swipe events. \r\n\r\nGesture List\r\nsingletap\r\ndoubletap\r\ntwofingertap\r\nswipe\r\npinch\r\nlongpress\r\n", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-03-29T14:07:55.000+0000", "updated": "2012-03-29T14:07:55.000+0000" }, { "id": "189197", "author": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "body": "Vishal, so how would do what the customer is trying to do? Ti.UI.TableViewRow doesn't register any gestures, according to our documentation.", "updateAuthor": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "created": "2012-03-29T14:12:36.000+0000", "updated": "2012-03-29T14:12:36.000+0000" }, { "id": "189701", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Ok my mistake, gesture recognizers are always registered. Anyways like click events the swipe gesture will report the actual view on which the gesture occurred. Try this code. Swiping should give you the correct row id.\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: 'white'\r\n});\r\n \r\nvar table = Ti.UI.createTableView();\r\nvar data = [];\r\n \r\nfor (var i = 0; i < 20; i++)\r\n{\r\n var row = Ti.UI.createTableViewRow({\r\n });\r\n \r\n var enabledWrapperView = Ti.UI.createView({\r\n \tmyRowID: i,\r\n \twidth:Ti.UI.FILL,//Set to 100% for 1.8.X\r\n \theight:Ti.UI.SIZE//Set to auto for 1.8.X\r\n })\r\n \r\n var disabledWarpperView = Ti.UI.createView({\r\n \ttouchEnabled:false,\r\n \twidth:Ti.UI.FILL,//Set to 100% for 1.8.X\r\n \theight:Ti.UI.SIZE//Set to auto for 1.8.X\r\n })\r\n var label = Ti.UI.createLabel({\r\n text: i,\r\n left: 0,\r\n width: 'auto',\r\n });\r\n \r\n enabledWrapperView.add(disabledWarpperView);\r\n disabledWarpperView.add(label);\r\n row.add(enabledWrapperView);\r\n data.push(row);\r\n}\r\n \r\ntable.setData(data);\r\n\r\ntable.addEventListener('swipe', function(e)\r\n{\r\n var row = e.source;\r\n \r\n if (!row)\r\n return;\r\n \r\n Ti.API.info('Row swiped: ' + row);//This should return enabledWrapperView\r\n Ti.API.info('Row ID : ' + row.myRowID);\r\n});\r\n\r\nwin.add(table);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-04-03T13:47:07.000+0000", "updated": "2012-04-03T13:52:45.000+0000" }, { "id": "189706", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Provided JS workaround", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-04-03T13:56:35.000+0000", "updated": "2012-04-03T13:56:35.000+0000" }, { "id": "189711", "author": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Marking this bug invalid as the functionality works as expected. We have just provided information on how to make use of this functionality.", "updateAuthor": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-03T14:14:46.000+0000", "updated": "2012-04-03T14:14:46.000+0000" }, { "id": "194800", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Surely there should be no need for the enabledWrapperView? Why doesn't the row respond as the source of a table swipe event, if all child views have touchEnabled set to false?", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-05-15T04:14:40.000+0000", "updated": "2012-05-15T04:14:40.000+0000" }, { "id": "415417", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid with reference to the previous comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-23T21:37:47.000+0000", "updated": "2017-03-23T21:37:47.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }