{
"id": "148243",
"key": "ALOY-1275",
"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": [],
"resolution": null,
"resolutiondate": null,
"created": "2015-05-26T22:05:49.000+0000",
"priority": {
"name": "Medium",
"id": "3"
},
"labels": [
"qe-4.0.1"
],
"versions": [
{
"id": "16596",
"name": "Alloy 1.6.0",
"archived": false,
"released": true,
"releaseDate": "2015-05-21"
}
],
"issuelinks": [],
"assignee": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"updated": "2015-07-29T00:12:48.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": "12329",
"name": "Runtime",
"description": "Generic bucket for uncategorized runtime issues"
}
],
"description": "When trying to override a function in an Alloy project, the function is not overridden if the 'child' controller is opened vs the function being called from the unopened controller.\r\n\r\n*Steps to reproduce issue*\r\n1. Create an Alloy project using the below files\r\n2. Run the project\r\n3. Click 'Create Ewan'\r\n4. Click on 'Ewan'\r\n\r\n*Actual Results*\r\nAn alert appears with \"Ewan\"\r\n\r\n*Expected Results*\r\nAn alert appears with \"OVERRIDE!\"\r\n\r\n*Notes*\r\nIf line 2 of {{index.js}} is changed to:\r\n{{Alloy.createController(\"ewan\").sayName()}} the function works as expected.\r\n\r\n*Files*\r\nindex.js:\r\n{code}\r\nfunction makeEwan(){\r\n\tAlloy.createController(\"ewan\").getView().open();\r\n}\r\n\r\n$.index.open();\r\n{code}\r\n\r\nperson.js:\r\n{code}\r\nvar args = arguments[0] || {};\r\n\r\nexports.sayName = function(){\r\n\targs.name ? alert(args.name) : alert($.name.text);\r\n\t$.win2.close();\r\n};\r\n{code}\r\n\r\newan.js:\r\n{code}\r\nexports.baseController = 'person';\r\n\r\n$.name.text = \"Ewan\";\r\nexports.sayName = function() {\r\n\talert(\"OVERRIDE!\");\r\n $.win2.close();\r\n};\r\n{code}\r\n\r\nindex.xml:\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nperson.xml:\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}",
"attachment": [],
"flagged": false,
"summary": "Override not working when child controller is opened",
"creator": {
"name": "ewieber",
"key": "ewieber",
"displayName": "Eric Wieber",
"active": false,
"timeZone": "America/Los_Angeles"
},
"subtasks": [],
"reporter": {
"name": "ewieber",
"key": "ewieber",
"displayName": "Eric Wieber",
"active": false,
"timeZone": "America/Los_Angeles"
},
"environment": "MacOS 10.10.3\r\nStudio 4.0.0.201505202026\r\nTi SDK 4.0.1.v20150521135010\r\nAppc NPM 4.0.0\r\nAppc CLI 4.0.1-0\r\nTi CLI 4.0.0\r\nAlloy 1.6.0\r\nNode v0.10.37\r\nJava 1.7.0_45",
"comment": {
"comments": [
{
"id": "358462",
"author": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"body": "This seems like a limitation on the existing Alloy's inheritance model, specifically inheriting event handlers is not supported directly. \r\nIt's still possible to archive what you are trying to do, albeit with some changes in code: \r\n\r\n{code:title=index.js}\r\nfunction makeEwan(e){\r\n\tvar ewan = Alloy.createController(\"ewan\");\r\n\tewan.init();\r\n\tewan.getView().open();\r\n}\r\n$.index.open();\r\n{code}\r\n\r\n{code:title=person.js}\r\nvar args = arguments[0] || {};\r\n\r\nexports.sayName = function(){\r\n\targs.name ? alert(args.name) : alert($.name.text);\r\n\t$.win2.close();\r\n};\r\n\r\nexports.init = function() {\r\n\t$.name.addEventListener('click', $.sayName);\r\n};\r\n{code}\r\n\r\n{code:title=person.xml}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}",
"updateAuthor": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"created": "2015-07-28T22:33:15.000+0000",
"updated": "2015-07-28T22:33:15.000+0000"
}
],
"maxResults": 1,
"total": 1,
"startAt": 0
}
}
}