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

Alloys Data Binding feature does not respect platform property

    Details

    • Sprint:
      2014 Sprint 10 Alloy

      Description

      Hi,

      when using data binding on an element limited to a specific platform, the data function will be created twice. After compiling the example below you will notice the created resource contains two render functions. The render function for iOS and MobileWeb overwrites the function for Android. Calling $.destroy() might break on iOS because the Android related collection is not defined.

      Link to Q&A: http://developer.appcelerator.com/question/153195/alloys-data-binding-feature-does-not-respect-platform-property

      View:

      <Alloy>
          <Collection src="test" />
          <Window id="index">
              <View id="content" dataCollection="test" dataFunction="render" platform="android">
                  <View></View>
              </View>
              <TableView id="content" dataCollection="test" dataFunction="render" platform="ios,mobileweb">
                  <TableViewRow>
                      <View></View>
                  </TableViewRow>
              </TableView>
          </Window>
      </Alloy>
      

      Controller:

      $.index.open(); 
       
      render();
       
      $.destroy();
      

      Model:

      exports.definition = {
       
        configuration : {
          "columns": {
            "username":"string"
          },
          "adapter": {
            "type": "sql",
            "collection_name": "test"
          },
        },
       
        extendModel: function(Model) {
       
          _.extend(Model.prototype, {});
       
          return Model;
        },
       
        extendCollection: function(Collection) {
       
          _.extend(Collection.prototype, {});
       
          return Collection;
        }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                skypanther Tim Poulsen
                Reporter:
                jicks83 Jick Steen
              • Watchers:
                5 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 Integration