{ "id": "104465", "key": "ALOY-368", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "15271", "description": "Alloy 1.1.0, concurrent with SDK 3.1.0", "name": "Alloy 1.1.0", "archived": false, "released": true, "releaseDate": "2013-04-16" }, { "id": "14873", "description": "2013 Sprint 04", "name": "2013 Sprint 04", "archived": true, "released": true, "releaseDate": "2013-02-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-03-11T15:52:58.000+0000", "created": "2012-11-06T17:54:30.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "runtime" ], "versions": [], "issuelinks": [], "assignee": null, "updated": "2018-03-07T22:26:03.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12333", "name": "Widgets" } ], "description": "Since Widgets are supposed to act as standalone instances, how do I go about creating multiple view/controllers and referencing them appropriately through createController? \r\n\r\nExample:\r\n\r\nWIdgetA has two views \r\nwidget.xml\r\nmenu.xml\r\n\r\nWidgetA controller wants to create an instance of menu.xml using createController\r\nvar m = Alloy.createController(\"menu\", {some object}).getView()\r\n\r\nExpectation is the above should reference the widgets menu view/controller\r\n\r\nActual result – alloy tries to find the controller within the base alloy/controllers folder\r\n\r\n", "attachment": [], "flagged": false, "summary": "Widgets should reference controllers within their standalone structure when using createController", "creator": { "name": "bgrantges@appcelerator.com", "key": "bgrantges", "displayName": "Bert Grantges", "active": false, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "bgrantges@appcelerator.com", "key": "bgrantges", "displayName": "Bert Grantges", "active": false, "timeZone": "America/Chicago" }, "environment": "iOS / Android", "comment": { "comments": [ { "id": "226963", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Agree 100%, or at least support using WPATH in a widget controller to explicitly reference to other controllers within the widget:\r\n\r\n{code}\r\nvar row = Alloy.createController(WPATH('row'), arg).getView();\r\n{code}\r\n\r\nI do see a WPATH implementation in the Alloy-generated {{widget.js}}:\r\n\r\n{code}\r\nfunction WPATH(s) {\r\n var index = s.lastIndexOf(\"/\"), path = index === -1 ? \"MyWidget/\" + s : s.substring(0, index) + \"/MyWidget/\" + s.substring(index + 1);\r\n return path;\r\n}\r\n{code}\r\n\r\nBut using it results in:\r\n\r\n{code}\r\nalloy/controllers/MyWidget/row\r\n{code}\r\n\r\nA workaround is to use:\r\n\r\n{code}\r\nvar row = Alloy.createWidget('MyWidget', 'row', arg).getView();\r\n{code}\r\n\r\nOr is this actually the (undocumented) way to do it? You might think so since {{createWidget}} supports a controller name as a second parameter.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-11-11T07:34:19.000+0000", "updated": "2012-11-11T07:34:19.000+0000" }, { "id": "241575", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The was handled in ALOY-530. The Alloy creation functions, like createController(), should be accessed in widget's like this:\r\n\r\n{code:javascript}\r\nwidget.createController('viewName', args);\r\n{code}\r\n\r\nThis will use the controllers contained within the widget. The same goes for the model and collection creation functions. createWidget() still references the global collection of widgets as it should.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-11T15:52:58.000+0000", "updated": "2013-03-11T15:52:58.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }