Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1480] Bug/Regression: Data binding always returns string values

GitHub Issuen/a
Resolution Date2016-04-24T01:31:46.000+0000
Affected Version/sAlloy 1.5.0, alloy 1.8.1, alloy 1.8.5
Fix Version/sRelease 5.4.0, alloy 1.9.0, alloy 1.9.1
Labelsalloy, qe-5.4.0
ReporterAndrea Vitale
AssigneeFokke Zandbergen


For ALOY-443 (Alloy 1.5.0) we started to use _.template() for complex model data binding. With ALOY-1368 and ALOY-1369 we also adopted this method for complex collection data binding. Since _.template() always returns a string, it doesn't work for binding objects, e.g. an attributedString as the attached test case:
	<Collection src="source" />
	<Window class="container">
		<ListView id="List" defaultItemTemplate="test" top="30">
				<ItemTemplate name="test" height="50">
					<View height="Ti.UI.SIZE" layout="vertical">
						<Label id="simpleTestLabel" bindId="simpleTestLabel"></Label>
						<Label id="attributedTestLabel" bindId="attributedTestLabel" top="5"></Label>
			<ListSection dataCollection="source" dataTransform="transform">
				<ListItem simpleTestLabel:text="{simple}" attributedTestLabel:attributedString="{attributedString}"></ListItem>

Original description

Just tested that, using alloy v1.8.2 and v1.8.5 I was unable to set the attributedString property via a ListItem template. Using alloy 1.7.35 everything is working fine. I attach a simple test project that contains a ListView with a template composed by two labels. On the first label I set the text property with a simple model string and on the second one i set the attributedString. For the first label everything is working correctly (as expected) and for the second one is working only using v1.7.35 of alloy.




  1. Fokke Zandbergen 2016-03-31

    Combined PR for ALOY-1478, ALOY-1480, ALOY-1481 and ALOY-1482: https://github.com/appcelerator/alloy/pull/780
  2. Fokke Zandbergen 2016-03-31

    [~bimmel] could you list this as a known issue for Alloy 1.8.5 (since that will ship with CLI 5.2.2) ?
  3. (deactived) Brian Immel 2016-03-31

    [~fokkezb], Not a problem.
  4. Feon Sua Xin Miao 2016-04-24

    PR merged.
  5. Josh Longton 2016-07-08

    Verified as fixed. Tested on:
 iPhone 6 (9.1) iOS Simulator (9.3) Android emulator (6.0) 
Mac OSX El Capitan 10.11.5 Studio: 
Ti SDK: 5.4.0.v20160705213725 
Appc NPM: 4.2.8-1 Appc CLI: 5.4.0-29 
Xcode 7.3.1 Node v4.4.4 *
Closing Ticket*

JSON Source