Titanium JIRA Archive
Alloy (ALOY)

[ALOY-954] <ItemTemplate> sometimes not applied properly to <ListView>

GitHub Issuen/a
TypeBug
PriorityHigh
StatusResolved
ResolutionCannot Reproduce
Resolution Date2014-02-11T15:43:19.000+0000
Affected Version/sAlloy 1.3.1
Fix Version/s2014 Sprint 03
ComponentsStyling, XML
Labelsn/a
ReporterTim Statler
AssigneeUnknown
Created2014-02-11T01:38:06.000+0000
Updated2018-03-07T22:25:39.000+0000

Description

In attached Alloy project the <ItemTemplate> is applied correctly when I <require> it into a ListView. But when the same code is "manually" added to the ListView it doesn't render as expected.. In attached project, when I run the following code, the row is not formatted correctly (see attached, image1.png).
 
<Templates>                     
    <!-- <Require src="itemtemplate"></Require> -->
    <ItemTemplate name="itemtemplate" height="70">
        <ImageView id="leftImage" bindId="leftImage"/>
        <Label id="title" bindId="title"/>
        <Label id="subtitle" bindId="subtitle"/>
        <ImageView id="rightImage" bindId="rightImage"/>
    </ItemTemplate>
</Templates>
<ListSection>
    <ListItem template="itemtemplate" leftImage:image="/images/alien.png" rightImage:image="/images/up.png" title:text="Alien" subtitle:text="In space, no one can hear you scream"/>
</ListSection>
But if I the from another file it works -- that is, if you uncomment the require and comment out the previous code.
 
<Templates>                     
    <Require src="itemtemplate"></Require>
</Templates>
Expected: Runtime behavior should be identical.

Attachments

FileDateSize
listitem_template.zip2014-02-11T01:39:26.000+00006081504

Comments

  1. Tony Lukasavage 2014-02-11

    [~tstatler] I notice you mentioned Alloy 1.3.1 was the problem? Does this issue exist with 1.3.0? Trying to determine if this is a regression.
  2. Tim Poulsen 2014-02-11

    I can't reproduce this. SDK: 3.2.0.GA.d9182d6 CLI: 3.2.1 Alloy: 1.3.1 I did copy the contents of itemtemplate.tss into the index.tss, otherwise the images and labels are all centered in the listitem. However, even without that, the template is being applied, and the listitem details are being properly set whether I include the template inline or via Require.
  3. Tim Poulsen 2014-02-11

    Sorry for the version mixup. But I still can't reproduce using 3.2.1.GA. It works fine for me, with TSS changes noted above, with the template included directly in the index.xml.

JSON Source