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

Override not working when child controller is opened

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: Alloy 1.6.0
    • Fix Version/s: None
    • Component/s: Runtime
    • Labels:
    • Environment:

      MacOS 10.10.3
      Studio 4.0.0.201505202026
      Ti SDK 4.0.1.v20150521135010
      Appc NPM 4.0.0
      Appc CLI 4.0.1-0
      Ti CLI 4.0.0
      Alloy 1.6.0
      Node v0.10.37
      Java 1.7.0_45

      Description

      When trying to override a function in an Alloy project, the function is not overridden if the 'child' controller is opened vs the function being called from the unopened controller.

      Steps to reproduce issue
      1. Create an Alloy project using the below files
      2. Run the project
      3. Click 'Create Ewan'
      4. Click on 'Ewan'

      Actual Results
      An alert appears with "Ewan"

      Expected Results
      An alert appears with "OVERRIDE!"

      Notes
      If line 2 of index.js is changed to:
      Alloy.createController("ewan").sayName() the function works as expected.

      Files
      index.js:

      function makeEwan(){
      	Alloy.createController("ewan").getView().open();
      }
       
      $.index.open();
      

      person.js:

      var args = arguments[0] || {};
       
      exports.sayName = function(){
      	args.name ? alert(args.name) : alert($.name.text);
      	$.win2.close();
      };
      

      ewan.js:

      exports.baseController = 'person';
       
      $.name.text = "Ewan";
      exports.sayName = function() {
      	alert("OVERRIDE!");
          $.win2.close();
      };
      

      index.xml:

      <Alloy>
      	<Window class="container">
      		<Label id="label" onClick="makeEwan">Create Ewan</Label>
      	</Window>
      </Alloy>
      

      person.xml:

      <Alloy>
      	<Window id="win2" class="container">
      		<Label id="name" onClick="exports.sayName">No Name</Label>
      	</Window>
      </Alloy>
      

        Attachments

          Activity

            People

            • Assignee:
              fmiao Feon Sua Xin Miao
              Reporter:
              ewieber Eric Wieber (Inactive)
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration