Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-1480

Bug/Regression: Data binding always returns string values

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Alloy 1.5.0, alloy 1.8.1, alloy 1.8.5
    • Component/s: Models
    • Labels:
    • Environment:

      Mac OSX El Capitan
      iOS simulator 9.3
      Ti CLI 5.0.6
      Ti SDK 5.2.1.GA

    • Story Points:
      8
    • Sprint:
      2016 Sprint 09 Tooling

      Description

      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:

      <Alloy>
      	<Collection src="source" />
      	<Window class="container">
      		<ListView id="List" defaultItemTemplate="test" top="30">
      			<Templates>
      				<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>
      					</View>
      				</ItemTemplate>
      			</Templates>
      			<ListSection dataCollection="source" dataTransform="transform">
      				<ListItem simpleTestLabel:text="{simple}" attributedTestLabel:attributedString="{attributedString}"></ListItem>
      			</ListSection>
      		</ListView>
      	</Window>
      </Alloy>
      

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fokkezb Fokke Zandbergen
                Reporter:
                Andrea.Vitale Andrea Vitale
                Reviewer:
                Feon Sua Xin Miao
              • Watchers:
                8 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