Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-26498

Windows: ListView item template support CommonJS modules and Alloy widgets

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Release 7.5.0
    • Fix Version/s: Release 8.0.0
    • Component/s: Windows
    • Labels:
    • Story Points:
      13
    • Sprint:
      2018 Sprint 25

      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:

      1. If there's a class in global namespace such as Ti.UI.View, use [namespace].create[Classname] function such as Ti.UI.createView.
      2. If there's a CommonJS module with given name, require it and then use its getView function.
      3. 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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kiguchi Kota Iguchi
                Reporter:
                fmiao Feon Sua Xin Miao
                Reviewer:
                Josh Longton
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code