[ALOY-678] Adding child Views to Ti.UI.View in ItemTemplate fails
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-06-12T20:29:21.000+0000 |
Affected Version/s | Alloy 1.2.0 |
Fix Version/s | Alloy 1.2.0, 2013 Sprint 12 |
Components | Runtime, XML |
Labels | qe-testadded |
Reporter | Timan Rebel |
Assignee | Tony Lukasavage |
Created | 2013-05-29T15:48:54.000+0000 |
Updated | 2013-07-15T21:46:10.000+0000 |
Description
In the new Alloy 1.2.0 it is possible to define ListView ItemTemplates in the View.xml (#ALOY-608)
<Alloy>
<ListView id="list" defaultItemTemplate="track">
<Templates>
<ItemTemplate name="track" >
<ImageView bindId="avatar" class="avatar" />
</ItemTemplate>
</Templates>
</ListView>
</Alloy>
You can't use Ti.UI.View with child Views however. (It works without child Views though)
Works:
<Alloy>
<ListView id="list" defaultItemTemplate="track">
<Templates>
<ItemTemplate name="track" >
<View />
</ItemTemplate>
</Templates>
</ListView>
</Alloy>
Does not work:
<Alloy>
<ListView id="list" defaultItemTemplate="track">
<Templates>
<ItemTemplate name="track" >
<View>
<ImageView bindId="avatar" class="avatar" />
</View>
</ItemTemplate>
</Templates>
</ListView>
</Alloy>
This can be solved to allow further nesting of childTemplates. See http://docs.appcelerator.com/titanium/latest/#!/guide/ListViews-section-37521650_ListViews-ItemTemplate
It might be that it is already implemented, but that I hit a bug, because the generated code fails on:
var __alloyId32={type:'Ti.UI.View',var __alloyId33=[]
[ERROR] : Alloy compiler failed
Attachments
File | Date | Size |
---|---|---|
Screen Shot 2013-06-12 at 4.19.47 PM.png | 2013-06-12T20:29:46.000+0000 | 48931 |
Screen Shot 2013-06-12 at 4.19.57 PM.png | 2013-06-12T20:29:46.000+0000 | 38555 |
PR: https://github.com/appcelerator/alloy/pull/155 test app: https://github.com/appcelerator/alloy/tree/master/test/apps/testing/ALOY-678 This test will functionally pass simply by running on both iOS and Android, showing all of the ugly, nested rows contained in the app. I attached 2 screenshots to show the expected state of the loaded app on android and ios.
Verified as fixed. Environment: Titanium SDK 3.1.2.v20130710144553 Appcelerator Studio 3.1.2.201307101037 Alloy 1.2.0 Android device 4.2.2 and iOS 5 Closing.