[TIMOB-26498] Windows: ListView item template support CommonJS modules and Alloy widgets
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2018-12-11T14:05:23.000+0000 |
| Affected Version/s | Release 7.5.0 |
| Fix Version/s | Release 8.0.0 |
| Components | Windows |
| Labels | parity |
| Reporter | Feon Sua Xin Miao |
| Assignee | Kota Iguchi |
| Created | 2018-10-30T07:06:26.000+0000 |
| Updated | 2019-01-03T12:12:44.000+0000 |
Description
The ListView item template only supports a limited set of view classes from the Ti.UI namespace. In addition to using one of the predefined view classes, you should be able to also pass module views to your list item template. For example, use If there's a class in global namespace such as
If there's a CommonJS module with given name,
If there's a Alloy widget with given name,
ImageView on AvImageview module in your list view:
<ListView id="Images" defaultItemTemplate="template">
<Templates>
<ItemTemplate name="template" height="160">
<ImageView ns="AvImageview" bindId="photo" height="160" width="Ti.UI.FILL" />
</ItemTemplate>
</Templates>
<ListSection>
<ListItem template="template" photo:image="http://www.nationalgeographic.com/content/dam/photography/photos/000/060/6018.ngsversion.1467254523217.adapt.1900.1.jpg"></ListItem>
<ListItem template="template" photo:image="http://www.italiangoodnews.com/wp-content/uploads/2014/11/italy-04.jpg"></ListItem>
</ListSection>
</ListView>
where <ImageView ns="AvImageview"> will be expanded into type: 'AvImageview.ImageView' in ListView ItemTemplate. In this case ListView should call AxImageview.createImageView behind the scenes eventually.
We also need support for Alloy Widget tag like below.
<ListView id="listView" defaultItemTemplate="template">
<Templates>
<ItemTemplate name="template">
<Widget src="test.widget" bindId="testWidget" id="testWidget"/>
</ItemTemplate>
</Templates>
<ListSection headerTitle="WIDGETS">
<ListItem testWidget:backgroundColor="red" />
<ListItem testWidget:backgroundColor="blue" />
<ListItem testWidget:backgroundColor="orange" />
</ListSection>
</ListView>
In this case <Widget src="test.widget"> will be expanded into type: 'test.widget' in ListView ItemTemplate. In this case ListView should create Alloy widget test.widget behind the scenes eventually.
So, ListView should search template class in following order:
https://github.com/appcelerator/titanium_mobile_windows/pull/1310
*FR Passed*
Closing ticket. Fix verified in SDK version
8.0.0.v20190102142454Test and other information can be found at: https://github.com/appcelerator/titanium_mobile_windows/pull/1310