[ALOY-944] Add "setTopLevelViews" so controllers extending others can redefine the UI
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | alloy, basecontroller, controller, inheritance, view |
Reporter | Fokke Zandbergen |
Assignee | Unknown |
Created | 2014-01-29T19:22:19.000+0000 |
Updated | 2018-03-07T22:26:08.000+0000 |
Description
When a controller uses the
baseController
property, it will basically result in the compiled controller extending the specified controller instead of the standard [BaseController.js](https://github.com/appcelerator/alloy/blob/master/Alloy/lib/alloy/controllers/BaseController.js). The extending controller will inherit the extended controller's UI and non-private controller code.
This is nice for cases like the [inheritance example](https://github.com/appcelerator/alloy/blob/master/test/apps/advanced/inheritance/_generated/ios/alloy/controllers/animatedDialog.js) in the Alloy repo where only the controller-part is extended, but there is no way to do the same with the UI. This is because the top-level views of a controller are stored in a private roots
variable of the extended controller. You can push new top-level views using addTopLevelView
, but not remove any.
I would like to have the possibility of re-setting the top-level views for the extending controller, so that I can decide what parts of the exteded controller's UI I want to re-use by adding them to the extending controller UI and then add then set that UI as the top-level.
I guess it might be as simple as adding a setTopLevelViews
method to the BaseController
that would accept an array of views that it replace roots
with?
Looking forward to your thoughts.
No comments