{ "id": "150068", "key": "TIMOB-19327", "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": null, "resolutiondate": null, "created": "2015-07-31T19:10:34.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [ { "id": "16919", "description": "Critical updates", "name": "Release 4.1.1", "archived": true, "released": true, "releaseDate": "2015-07-15" } ], "issuelinks": [], "assignee": null, "updated": "2018-02-28T19:55:14.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" }, { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Create a default Alloy project with the following:\r\n\r\nindex.xml\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t \r\n\t \t\r\n\t \r\n\t \r\n\t \r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nindex.js\r\n{code}\r\nvar handler = function() {\r\n\tTi.API.info(\"longpressed\");\r\n};\r\n\r\nvar list1Click = function(){\r\n\tTi.API.info(\"item clicked\");\r\n};\r\n$.index.open();\r\n{code}\r\n\r\nOn iOS, the function \"handler\" is simply not working. On Android, it'll throw exception saying event handler undefined. However, itemclick event works fine.\r\n\r\nIf we declare function \"handler\" like the following, then it works fine on both iOS and Android.\r\n{code}\r\nfunction handler() {\r\n\tTi.API.info(\"longpressed\");\r\n}\r\n\r\nvar list1Click = function(){\r\n\tTi.API.info(\"item clicked\");\r\n};\r\n$.index.open();\r\n{code}\r\n\r\nSo event handler for template element can't be declared using \"var.\" This inconsistency could cause confusion to developer.", "attachment": [], "flagged": false, "summary": "ListView - template event handler not working if using \"var\" declaratoin", "creator": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "shawnlan", "key": "shawnlan", "displayName": "Shawn Lan", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "SDK 4.1.0/iOS/Android", "comment": { "comments": [], "maxResults": 2, "total": 2, "startAt": 0 } } }