Titanium JIRA Archive
Alloy (ALOY)

[ALOY-944] Add "setTopLevelViews" so controllers extending others can redefine the UI

GitHub Issuen/a
Affected Version/sn/a
Fix Version/sn/a
Labelsalloy, basecontroller, controller, inheritance, view
ReporterFokke Zandbergen


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

JSON Source