[ALOY-785] Pass TabGroup as __parentSymbol to widgets providing a tab
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Low |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | Alloy 1.2.0 |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | alloy, parent, tabgroup |
| Reporter | Daniel Sefton |
| Assignee | Unknown |
| Created | 2013-08-14T15:05:56.000+0000 |
| Updated | 2018-03-07T22:26:03.000+0000 |
Description
In the following code the widget providing the tab gets no reference to the TabGroup. Because of this, it cannot change the TabGroup's activeTab, ActionBar or perform other context-aware actions.
*views/index.xml*
<Alloy>
<TabGroup>
<Widget src="myTab" />
</TabGroup>
</Alloy>
*widgets/myTab/views/widget.xml*
<Alloy>
<Tab>
<Window />
</Tab>
</Alloy>
Solution
This could easily be solved by having Alloy pass the TabGroup via the__parentSymbol property also found in other places where a widget is used. IMHO this property should/could *always* be passed to widgets/required controllers.
Notes
* Any workaround requiring code in the index-controller is not honoring the fact that widgets should be self-sustained. * Having said the above, even assign the TabGroup toAlloy.Globals. won't work since the tabs will be created before the controller code is executed.
No comments