Search code examples
javascriptextjsextjs6-classic

How to execute child method inside parent ExtJs(Sencha)


I have two controllers:

Ext.define('ParentController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.parent',
    sayHelloFromChild: function() {
      this.sayHello(); // Uncaught TypeError: this.sayHello() is not a function
    }
});

Ext.define('ChildController', {
    extend: 'ParentController',
    alias: 'controller.child',
    sayHello: function() {
      console.log('Hello);
    }
});

I want to call child method sayHello(); inside parent controller.


Solution

  • i just tested in sencha fiddle.

    Look : https://fiddle.sencha.com/#view/editor&fiddle/2r1g

    You have syntax error in console.log('Hello);. This is a problem.