{ "id": "149129", "key": "ALOY-1283", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "16907", "name": "Release 5.1.0", "archived": false, "released": true, "releaseDate": "2015-10-28" }, { "id": "17115", "name": "alloy 1.7.18", "archived": false, "released": true, "releaseDate": "2015-10-15" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-10-16T00:38:14.000+0000", "created": "2015-06-25T10:16:10.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [ { "id": "16876", "name": "Alloy 1.6.2", "archived": false, "released": true, "releaseDate": "2015-06-11" }, { "id": "17103", "name": "alloy 1.7.17", "archived": false, "released": true, "releaseDate": "2015-10-14" } ], "issuelinks": [ { "id": "48196", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "138359", "key": "ALOY-1175", "fields": { "summary": "Cannot call methods or access properties on MenuItems declared in markup", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2015-11-10T23:35:36.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": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "ALOY-1175 fixed this issue for IDs set on {{}} but it is still an issue for views under {{}}. Because they are created after the controller merges {{$.__views}} with {{$}} you cannot access the views via {{$.}}.\r\n\r\n*index.xml*\r\n\r\n{code:xml}\r\n\r\n \r\n \r\n \r\n \r\n \r\n \t\r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}\r\n\r\n*index.js*\r\n\r\n{code:javascript}\r\n$.index.open();\r\n \r\nfunction changeColor() {\r\n $.myViewInActionView.backgroundColor = 'green';\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "ActionView views with an ID cannot be found under $ because they are created after merge", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "Alloy 1.6.2", "closedSprints": [ { "id": 512, "state": "closed", "name": "2015 Sprint 21 Tooling", "startDate": "2015-10-12T21:15:56.572Z", "endDate": "2015-10-24T01:15:00.000Z", "completeDate": "2015-10-26T16:54:05.609Z", "originBoardId": 121 } ], "comment": { "comments": [ { "id": "366853", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "PR: https://github.com/appcelerator/alloy/pull/732", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2015-10-15T00:09:55.000+0000", "updated": "2015-10-15T00:09:55.000+0000" }, { "id": "366915", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~fmiao] I updated the test case to make it simpler but the PR doesn't fix it. The above - with your PR - compiles to:\r\n\r\n{code:javascript}\r\n function __alloyId4() {\r\n $.__views.index.removeEventListener(\"open\", __alloyId4);\r\n if ($.__views.index.activity) $.__views.index.activity.onCreateOptionsMenu = function(e) {\r\n $.__views.myViewInActionView = Ti.UI.createView({\r\n id: \"myViewInActionView\",\r\n backgroundColor: \"red\"\r\n });\r\n $.__views.__alloyId2 = Ti.UI.createButton({\r\n title: \"Change Color\",\r\n id: \"__alloyId2\"\r\n });\r\n $.__views.myViewInActionView.add($.__views.__alloyId2);\r\n changeColor ? $.addListener($.__views.__alloyId2, \"click\", changeColor) : __defers[\"$.__views.__alloyId2!click!changeColor\"] = true;\r\n var __alloyId3 = {\r\n title: \"Open\",\r\n showAsAction: Titanium.Android.SHOW_AS_ACTION_ALWAYS,\r\n id: \"__alloyId1\"\r\n };\r\n $.__views.myViewInActionView && (__alloyId3.actionView = $.__views.myViewInActionView);\r\n $.__views.__alloyId1 = e.menu.add(_.pick(__alloyId3, Alloy.Android.menuItemCreateArgs));\r\n $.__views.__alloyId1.applyProperties(_.omit(__alloyId3, Alloy.Android.menuItemCreateArgs));\r\n $.__alloyId1 = $.__views.__alloyId1;\r\n }; else {\r\n Ti.API.warn(\"You attempted to attach an Android Menu to a lightweight Window\");\r\n Ti.API.warn(\"or other UI component which does not have an Android activity.\");\r\n Ti.API.warn(\"Android Menus can only be opened on TabGroups and heavyweight Windows.\");\r\n }\r\n }\r\n{code}\r\n\r\nAnd since {{onCreateOptionsMenu}} executes _after_ {{_.extend($, $.__views);}} the above has no effect anymore on {{$}}.\r\n\r\nSo whatever happens inside {{onCreateOptionsMenu}} needs to write directly to {{$}} or merge its views with it at the end.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-10-15T09:34:38.000+0000", "updated": "2015-10-15T09:34:56.000+0000" }, { "id": "366957", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "It's interesting that the generated code is different for me.\r\n{code}\r\n $.__views.myViewInActionView.add($.__views.__alloyId3);\r\n changeColor ? $.addListener($.__views.__alloyId3, \"click\", changeColor) : __defers[\"$.__views.__alloyId3!click!changeColor\"] = true;\r\n $.myViewInActionView = $.__views.myViewInActionView; // <---- missing\r\n var __alloyId4 = {\r\n title: \"Open\",\r\n showAsAction: Titanium.Android.SHOW_AS_ACTION_ALWAYS,\r\n id: \"__alloyId1\"\r\n };\r\n{code}", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2015-10-15T21:08:32.000+0000", "updated": "2015-10-15T21:08:32.000+0000" }, { "id": "366959", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Sorry [~fmiao], my fault.. patched the wrong (global) alloy. Verified fixed.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-10-15T22:00:20.000+0000", "updated": "2015-10-15T22:00:32.000+0000" }, { "id": "366970", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "PR merged.", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2015-10-16T00:38:14.000+0000", "updated": "2015-10-16T00:38:14.000+0000" }, { "id": "369624", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\n\r\nMacOS 10.11.2 (15C31f)\r\nStudio 4.4.0.201511040454\r\nTi SDK 5.1.0.v20151110110428\r\nAppc NPM 4.2.1\r\nAppc CLI 5.1.0-45\r\nTi CLI 5.0.5\r\nAlloy 1.7.24\r\nArrow 1.3.19\r\nXcode 7.2 (7C46t)\r\nNode v0.12.7\r\nJava 1.7.0_80\r\nproduction\r\n\r\nActionViews can be accessed with $., as expected. Used the provided test code. ActionView properties/methods can be accessed during runtime with the standard $..", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-11-10T23:35:36.000+0000", "updated": "2015-11-10T23:35:36.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }