{ "id": "126308", "key": "TIMOB-16455", "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": "2020-02-19T13:48:53.000+0000", "created": "2014-02-12T14:35:34.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "parity" ], "versions": [], "issuelinks": [], "assignee": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2020-02-19T13:48:53.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Source: http://developer.appcelerator.com/question/162482/alloy-listview-with-switch-in-template \r\n\r\nThe event object, in particular e.source does not include the same properties as on iOS making it impossible to create a cross-platform solution to the developer's question.\r\n\r\nIn addition to the code I provided in that Q&A thread, I tried other solutions including this:\r\n\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\t \r\n\t\t \r\n\t\t \r\n\t\t \r\n\t\t \r\n\t\t \r\n\t\t \r\n\t\t\r\n\t\r\n \r\n{code}\r\n\r\n{code}\r\nvar items=[];\r\nfor(var i=0; i<4; i++){\r\n items.push({\r\n title: {text: 'Title one'}, \r\n checked: {value: false, myID: 'switch'+i}\r\n });\r\n};\r\n$.mySection.setItems(items);\r\n\r\nfunction doSwitchMe(e) {\r\n // result of next line is 'Switch undefined was clicked and is now on'\r\n alert('Switch ' + e.source.myID + ' was clicked and is now ' + ((e.source.value===true)? 'on' : 'off'));\r\n}\r\n\r\n$.index.open();\r\n{code}\r\n\r\nIn all cases, e.source doesn't include the custom myID property.", "attachment": [ { "id": "45846", "filename": "Screen Shot 2014-02-12 at 9.07.13 AM.png", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-02-12T14:35:34.000+0000", "size": 97465, "mimeType": "image/png" }, { "id": "45847", "filename": "Screen Shot 2014-02-12 at 9.07.44 AM.png", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-02-12T14:35:34.000+0000", "size": 94639, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Event object on ListItem child's change doesn't match iOS", "creator": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "environment": "SDK: 3.1.2.GA\r\nTI/CLI: 3.1.2\r\nAlloy: 1.3.1\r\niOS Sim: 7.0.3\r\nAndroid/Genymotion: 4.2.2", "comment": { "comments": [ { "id": "292852", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yes, this is an architecture parity between Android and iOS. We solved this by introducing 'itemId' property that you can use instead:\n{code}\nfor(var i=0; i<4; i++){\n items.push({\n properties: {itemId: 'switch ' +i},\n title: {text: 'Title one'}, \n checked: {value: false}\n });\n};\n...\nfunction doSwitchMe(e) {\n // result of next line is 'Switch undefined was clicked and is now on'\n alert('Switch ' + e.itemId + ' was clicked and is now ' + ((e.source.value===true)? 'on' : 'off'));\n}\n{code}", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-13T02:38:15.000+0000", "updated": "2014-02-13T02:38:15.000+0000" }, { "id": "292909", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Defining a custom property on each list item is an acceptable workaround. But since the e.source.value property is valid on both platforms, it really seems as though the other properties of that child item should be accessible on the e.source object. \n\nI've updated the Q&A thread with the workaround. Thanks Hieu.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-02-13T15:40:39.000+0000", "updated": "2014-02-13T15:40:39.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }