[ALOY-1061] Alloy: Require a specific view via XML
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Medium |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | XML |
| Labels | require, views, xml |
| Reporter | Fokke Zandbergen |
| Assignee | Unknown |
| Created | 2014-06-12T06:44:35.000+0000 |
| Updated | 2018-03-07T22:25:37.000+0000 |
Description
In JS you can get a specific controller view (including its children of course) by passing its ID to
getView() like this:
var view = Alloy.createController('foo').getView('bar');
I'd like to do the same in XML:
<Alloy>
<Require src="foo" view="header">
<View id="someOtherContent">..</View>
<Require src="foo" view="footer">
</Alloy>
Please note that the implementation should only create the foo controller *once*, so that both the header and footer view share the same controller. Otherwise it wouldn't make much sense since the actual benefit/use-case is that these 2 views can interact with/on each other while providing views at 2 or more different locations in te parent controller/view.
Reported by [~fokke] (changed by jira).