Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15091] iOS: Cannot use a module when using a listview childtemplates

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsTiAPI
LabelsQ3, android, demo_app, engArch, ios, listview, roadmap2019
ReporterBraden Powers
AssigneeVijay Singh
Created2013-07-18T02:31:24.000+0000
Updated2020-02-06T22:33:16.000+0000

Description

The issue is that I cannot use the styled label module that Appcelerator built in a ListView. The type for the ChildTemplates is expecting a string and cannot recognize the module. Please Advise.

Attachments

FileDateSize
Simulator Screen Shot - iPhone 6s - 2018-01-24 at 10.47.19.png2018-01-24T09:49:12.000+000046146

Comments

  1. Carter Lathrop 2013-07-25

    Hello Braden, From your bug report you are missing a few pieces of information that are necessary to quickly realize a solution for you. Please provide a simple test case that demonstrates the issue you are describing as well as steps to reproduce such issue. Please refer to: https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report For more information on what is necessary in a bug report. Thank you, Carter
  2. Brian OConnor 2013-09-09

    I have a similar issue. Don't see the necessity for a test case or steps to reproduce. This is not a bug but an oversight. I don't know how you could require more than to know you cannot use anything but Ti.UI components with ListView.
  3. Tony Lukasavage 2013-09-09

    [~bradenpowers], [~btoc007], we are lacking docs that make what is and isn't supported obvious to developers, which is resulting in this confusion. If you had access to the appropriate documentation this would be better listed as a feature request as it is simply not implemented yet. [~ingo], [~bhatfield], can we work on adding a clear list in the ListView API docs and guides that indicate specifically which UI components are supported? This is not the first time (even today) that I'm seeing confusion among developers due to the lack of an explicit list of supported UI components for ListView items.
  4. Braden Powers 2014-01-05

    I was looking through the documentation and it appears that it is still not possible to the use the module with a listview. Is this true? Do I have to submit a feature request?
  5. Hieu Pham 2014-02-26

    This is currently not supported. Please convert this ticket to a feature request.
  6. Tony Lukasavage 2014-02-26

    [~bradenpowers] while it may seem obvious, including a proposed example of how you think it should be made possible would be helpful. Just a short clear example of how you'd like to be able to use this functionality once it is implemented.
  7. Banzai Mobile 2014-07-23

    I see there hasn't been recent activity on this, so here are my two cents. I know nothing about internals of the ListView implementation, however. Many Titanium users badly need to include native module-created view objects in list templates. Examples: - Styled labels - Admob banners - etc Example of how I'd like to build a child template for a banner element, to be then composed in a more complex row: var AdMob = require('ti.admob'); var bannerTemplate = function() { banner = { // type: 'Ti.UI.View', creationMethod: AdMob.createView, bindId: 'banner', properties: { width: 300, height: 250, publisherId: "whatever" }, events: { didReceiveAd: function(e) { }, didFailToReceiveAd: function(e) { }, }; return banner; } Basically, instead of specifying a string with the Ti type, we would provide the factory creator method, that could then be passed the 'properties' as params at row instantiation time. Assuming of course that: - the provided creationMethod is anything (module method or even js func) that returns a view or viewproxy; - the native module is able to react to changes of its properties, if as I suspect ListView cell reuse is something like a big tree of applyProperties (ti.admob should be adapted for this). The above may be enough for many of the use cases I've seen in Q&A and tickets.
  8. Mark Mokryn 2015-01-07

  9. Mark Mokryn 2015-01-07

    Please reconsider the priority on this, there are numerous Q&A's on this: http://stackoverflow.com/questions/24713059/using-titanium-module-with-listview-template https://developer.appcelerator.com/question/154972/styledlabel-module-in-a-listview http://developer.appcelerator.com/question/176076/using-module-with-listview-template http://developer.appcelerator.com/question/176087 http://noodlecode.net/2014/04/use-view-from-custom-module-inside-titanium-listviewitem/ and more.... Thanks.
  10. Hans Knöchel 2018-01-24

    Hey guys, quick update on this: Would it be a suitable solution to introduce a "module" key in the item-template that would define the name of the module? Doing that, we could construct the internal proxy like all others then, for example a map inside a ListView: !Simulator Screen Shot - iPhone 6s - 2018-01-24 at 10.47.19.png|thumbnail! Code:
        var myTemplate = {
            childTemplates: [
                {
                    type: 'View',
                    module: 'TiMap',
                    bindId: 'map',
                    properties: {}
                }
            ]
        };
        
    The SDK-change to realize this is quite small, so this could be in future versions of the SDK. The only problem would be to know the actual name of the module root-class, which can differ from the actual name of the module because its generated by the module ID and not module name.
  11. Hans Knöchel 2018-01-24

    iOS-PR: https://github.com/appcelerator/titanium_mobile/pull/9767 Example:
        var win = Ti.UI.createWindow({
          backgroundColor: 'white'
        });
        var map = require('ti.map');
        
        var myTemplate = {
          childTemplates: [{
            type: 'View',
            module: map,
            bindId: 'map',
            properties: {}
          }]
        };
        
        var listView = Ti.UI.createListView({
          templates: {
            'template': myTemplate
          },
          defaultItemTemplate: 'template'
        });
        var sections = [];
        
        var fruitSection = Ti.UI.createListSection({
          headerTitle: 'Fruits / Frutas'
        });
        var fruitDataSet = [{
          map: {
            width: Ti.UI.FILL,
            height: 50
          }
        }, ];
        fruitSection.setItems(fruitDataSet);
        sections.push(fruitSection);
        
        listView.setSections(sections);
        win.add(listView);
        win.open();
        
    *Note*: This is only the iOS PR! To complete this request, we would need to do the same for Android.
  12. Hans Knöchel 2018-02-15

    Moving out of 7.1.0 due to missing the Android parity PR.
  13. Hans Knöchel 2019-03-25

    Can someone tell me why this was unassigned although in review? And no fix version? 17+ watchers should be sufficient enough to at least schedule this.

JSON Source