Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1221] Support Widgets and Require in ListItem Templates

GitHub Issuen/a
TypeImprovement
PriorityCritical
StatusResolved
ResolutionDuplicate
Resolution Date2018-06-27T08:18:16.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTooling, Widgets, XML
LabelsTCSupportTriage
ReporterManuel Lehner
AssigneeTim Poulsen
Created2014-08-26T12:52:27.000+0000
Updated2019-05-02T19:34:42.000+0000

Description

Comments

  1. Yiran Mao 2014-11-10

  2. Mark Mokryn 2015-01-06

    I think this ticket should also be expanded to include the Module element inside the template as well, e.g.
       <Module id="paint" module="ti.paint" method="createPaintView" eraseMode="false" strokeWidth="1.0" strokeColor="red" strokeAlpha="100" />
       
    Using SDK 3.4.1.GA and Alloy 1.5.1 on iOS I am not getting any compile or runtime errors, but the module proxy (e.g. createPaintView in the example above) is just not getting called. I'm trying to create a Facebook Like button per list item - to no avail :(
  3. Mark Mokryn 2015-01-07

    Is this issue due to Alloy or the ListView implementation in the SDK? And why is this still a Titanium Community issue since August?
  4. Tim Poulsen 2015-01-07

    There's a mix of limitations going on here. * The Alloy compiler doesn't currently support using widgets and require in templates. See ALOY-1220 and read through Tony's comments on ALOY-611 (which led to the creation of this ticket). * The SDK supports just a limited set of View proxies as children of ListItem, see the list at http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.ListItem I'm pretty sure there's a TIMOB ticket directly related to using modules (that expose view proxies) as children of listitems. But the best I can find at the moment is TIMOB-15091 I've moved this ticket to the Alloy project but I can't make commitments on when we'll get a chance to work on it considering our other priorities on the Tooling team.
  5. Mark Mokryn 2015-01-07

    [~skypanther] please change the title to "Support Widgets, Require, and Module in...." Thanks
  6. Mark Mokryn 2015-01-07

    Here is an example of requested functionality: In my [Facebook module](https://github.com/mokesmokes/titanium-ios-facebook) I am exposing a View proxy for the Like Button. I want a Like button per ListItem, e.g.
       <ItemTemplate name="team" height="Ti.UI.SIZE">
           <ImageView bindId="logoImage" height="120dp" width="120dp" top="10dp" left="10dp"/>	
           <Module module="com.facebook" bindId="like" method="createLikeButton" right="80dp" objectType="page" likeViewStyle="button" height="80dp" width="100dp"/>
       </ItemTemplate>
       
    Then in the controller code (and perhaps binding with the collection of teams) I want to set the Like Button's objectId (a property on the like) to "https://www.facebook.com/NYKnicks" and enable the user to like one of the NBA teams in the list. Currently this doesn't work - fb.createLikeButton() is not called, no support in the SDK and Alloy.
  7. Fokke Zandbergen 2015-01-08

    The challenge is that your <Module.. would need to be aware of it's context (an ItemTemplate) and then instead of generating require("com.facebook").createLikeButton({..}) return something like:
       {
         type: "com.facebook.LikeButton"
         bindId: "like"
         right: "80dp",
         objectType: "page",
         likeViewStyle: "button",
         height: "80dp",
         width: "100dp"
       }
       
    And then the ListView API needs to know how to construct the actual view for each ListItem by parsing the type property on the native-side. But if the module is a CommonJS module this wouldn't work because the native-side can't ask the module for the view.
  8. Mark Mokryn 2015-01-08

    [~fokke] perhaps I'm missing the conceptual difference between Ti.UI and require("com.facebook"). The view components are View Proxy and View in all cases. What's the big difference regarding the module? If one would need to add code to the module to make it compatible with item templates - so be it. This requirement should then be added to the module API.... But at this point this is entirely unclear/undocumented. Thanks :)
  9. Fokke Zandbergen 2015-01-08

    The ListView would need to know if the required module is a native module (in which case it should indeed be able to get the view) or a commonjs module - in which case it would almost certainly not.
  10. Mark Mokryn 2015-01-08

    Let's assume only compiled, native modules such as Facebook.
  11. Flavio De Stefano 2015-04-29

    @fokke Why, in a case of CommonJS module, wouldn't work?
  12. Fokke Zandbergen 2015-04-29

    [~kopiro] because the views are composed on the native side. So then it would reach back to the JS VM and get the CommonJS module to do it there. Prone for errors if not impossible at all.
  13. David He 2015-05-03

    +1 for this feature request. Really desire for this!!! I would have open this JIRA if this one not here!
  14. Cyprian Kowalczyk 2015-08-10

    Any update on this?
  15. Andrey Tkachenko 2015-09-15

  16. Andrey Tkachenko 2015-09-21

  17. Hans Knöchel 2018-06-27

    Fixed as part of ALOY-1518 and related tickets for SDK 7.4.0.
  18. Brian García 2019-02-21

    This is only partly fixed, Require tags are still unsupported
  19. Brian Knorr 2019-05-02

    Can we get this reopened? We also need to use Require inside an ItemTemplate for reuse.

JSON Source