Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-6452

Alloy custom $model.__transform mapping is broken

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: None
    • Component/s: Alloy
    • Labels:
      None
    • Environment:

      Appc CLI: 7.1.2
      Alloy CLI: 1.14.4
      Titanium CLI: 5.2.2
      Titanium SDK: 8.3.0 GA

      Description

      EDIT: Updated with working error example:

      This commit brokes this use case:

      • Custom mapping object with $model.__transform property

      Example:

      It's my fault Ewan. Try passing a deep object:

      [ERROR] Script Error {
      [ERROR]     column = 385;
      [ERROR]     line = 49;
      [ERROR]     message = "undefined is not an object (evaluating 'Alloy['Models']['user'].on')";
      [ERROR]     sourceURL = "file:///Users/jormagar/Library/Developer/CoreSimulator/Devices/E90BCD03-DD1A-4ED4-A53E-E855EAF8D0F7/data/Containers/Bundle/Application/1285D017-A679-4740-AF70-0C257BD62EAF/AlloyDeepBinding.app/alloy/controllers/detail.js";
      [ERROR]     stack = "    at Controller(/alloy/controllers/detail.js:49:385)\n    at (/alloy.js:428:53)\n    at doClick(/alloy/controllers/index.js:54:27)";
      [ERROR]     toJSON = "<KrollCallback: 0x600002b9d780>";
      [ERROR] } 
      

      //detail.xml
      <Alloy>
        <Window layout="vertical">  
          <Label text="{user.owner.name}" top="50"/>
          <Label text="{user.contributor.name}" top="75"/>
        </Window>
      </Alloy>
      

       
      //index.js
        function onClick() {
          Alloy.createController('MyView', {
            $model: {
              __transform: {
                user: {
                  owner: {
                    name: 'Bob'
                  },
                  contributor: {
                    name: 'Tom'
                  }
                }
              }
            }
          }).getView().open();
        }
       
      $.index.open();
      
      

      Coming back to the previous code before commit fixes it.

        Attachments

          Activity

            People

            • Assignee:
              shossain Shak Hossain (Inactive)
              Reporter:
              jormagar Jorge Macias Garcia
            • Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:

                Git Integration