Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26498] Windows: ListView item template support CommonJS modules and Alloy widgets

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-12-11T14:05:23.000+0000
Affected Version/sRelease 7.5.0
Fix Version/sRelease 8.0.0
ComponentsWindows
Labelsparity
ReporterFeon Sua Xin Miao
AssigneeKota Iguchi
Created2018-10-30T07:06:26.000+0000
Updated2019-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 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:

If there's a class in global namespace such as Ti.UI.View, use \[namespace\].create\[Classname\] function such as Ti.UI.createView.

If there's a CommonJS module with given name, require it and then use its getView function.

If there's a Alloy widget with given name, require Resources/windows/alloy/widgets/WIDGET_NAME/controllers/widget.js and then use its getView function

Comments

  1. Kota Iguchi 2018-11-07

    https://github.com/appcelerator/titanium_mobile_windows/pull/1310
  2. Josh Longton 2018-12-11

    *FR Passed*
  3. Samir Mohammed 2019-01-03

    Closing ticket. Fix verified in SDK version 8.0.0.v20190102142454 Test and other information can be found at: https://github.com/appcelerator/titanium_mobile_windows/pull/1310

JSON Source