{ "id": "123970", "key": "ALOY-904", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": "2013-12-18T11:34:35.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "proxy", "require", "widgets" ], "versions": [], "issuelinks": [], "assignee": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "updated": "2014-08-28T21:15:00.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": "12333", "name": "Widgets" } ], "description": "Following the discussion in #ALOY-903 I'd like to request that widgets and required controllers receive their parent element as an argument.\r\n\r\nh1. Why I need this... since Alloy 1.3.0\r\n\r\nAs I've understood from [~tlukasavage] this is similar but not exactly the same as the internally used {{__parentSymbol}}. I think this is in particular true for proxy elements since Alloy 1.3.0. Earlier, these received the {{__parentSymbol}} property and were bound to their parent from within the widget. Since Alloy 1.3.0 however, the binding takes place in the controller that hosts the table and the widget no longer receives the property:\r\n\r\n{code:javascript}\r\n $.__views.is = Alloy.createWidget(\"nl.fokkezb.infiniteScroll\", \"widget\", {\r\n id: \"is\"\r\n });\r\n onEnd ? $.__views.is.on(\"end\", onEnd) : __defers[\"$.__views.is!end!onEnd\"] = true;\r\n $.__views.ptr = Alloy.createWidget(\"nl.fokkezb.pullToRefresh\", \"widget\", {\r\n id: \"ptr\"\r\n });\r\n onEnd ? $.__views.ptr.on(\"release\", onEnd) : __defers[\"$.__views.ptr!release!onEnd\"] = true;\r\n $.__views.table = Ti.UI.createTableView({\r\n footerView: $.__views.is.getProxyPropertyEx(\"footerView\", {\r\n recurse: true\r\n }),\r\n headerPullView: $.__views.ptr.getProxyPropertyEx(\"headerPullView\", {\r\n recurse: true\r\n }),\r\n headerView: $.__views.ptr.getProxyPropertyEx(\"headerView\", {\r\n recurse: true\r\n }),\r\n id: \"table\"\r\n });\r\n{code}\r\n\r\nThis is fine and I guess better then before, but I'm sure it's possible to still pass the parent back to the widget?", "attachment": [ { "id": "46892", "filename": "StarWidget.zip", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-03-26T19:31:04.000+0000", "size": 5800495, "mimeType": "application/zip" } ], "flagged": false, "summary": "Requesting widgets/requires to receive reference to their parent", "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": null, "comment": { "comments": [ { "id": "292137", "author": { "name": "wood1k", "key": "wood1k", "displayName": "Alexey Chulochnikov", "active": true, "timeZone": "Europe/Helsinki" }, "body": "It would be great if this feature request will be resolved!", "updateAuthor": { "name": "wood1k", "key": "wood1k", "displayName": "Alexey Chulochnikov", "active": true, "timeZone": "Europe/Helsinki" }, "created": "2014-02-10T14:08:37.000+0000", "updated": "2014-02-10T14:08:37.000+0000" }, { "id": "298842", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Attaching a project the shows how you can access the parent via the $.parent property. Tested with SDK 3.2.2.GA and Alloy 1.3.1. There are some limitations. But perhaps this existing property addresses the requested functionality?", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-03-26T19:31:04.000+0000", "updated": "2014-03-26T19:31:04.000+0000" }, { "id": "299482", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~skypanther] as your project shows widgets/requires providing 'normal' views still get {{__parentSymbol}} and can use {{$.parent}}:\r\n\r\n{code}\r\n $.__views.index = Ti.UI.createWindow({\r\n backgroundColor: \"white\",\r\n id: \"index\"\r\n });\r\n $.__views.index && $.addTopLevelView($.__views.index);\r\n $.__views.starwidget = Alloy.createWidget(\"starrating\", \"widget\", {\r\n top: 50,\r\n left: 20,\r\n id: \"starwidget\",\r\n max: \"5\",\r\n initialRating: \"2.5\",\r\n __parentSymbol: $.__views.index\r\n });\r\n{code}\r\n\r\nHowever, as I explained in the description, widget/requires providing proxy properties do not anymore since 1.3.x.\r\n\r\nGet the diff?", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2014-04-01T14:42:42.000+0000", "updated": "2014-04-01T14:42:42.000+0000" }, { "id": "302197", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "PR: https://github.com/appcelerator/alloy/pull/370\r\n\r\nFunctional test\r\n\r\nRun the sample app included in the PR. In the log output, you should see the message \"Widget's parent id is IAmTheParent\" and there should be a red label in the window with the text \"Created in the widget\" which as it suggests, was defined in the code of the widget and added to the parent container using the new reference variable.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-04-23T14:49:37.000+0000", "updated": "2014-04-23T14:49:37.000+0000" }, { "id": "302352", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Added a failing test to the PR.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2014-04-24T06:50:31.000+0000", "updated": "2014-04-24T06:50:31.000+0000" }, { "id": "302384", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "PR doesn't address requested functionality and offers no benefit over existing code. PR closed without merging.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-04-24T15:03:33.000+0000", "updated": "2014-04-24T15:03:46.000+0000" }, { "id": "302403", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "A workaround might be to let the widget main view to be empty do that it gets the parent and then manually attach 2nd view of the same widget. Ugly, but might work...", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2014-04-24T16:44:17.000+0000", "updated": "2014-04-24T16:44:17.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }