0

I am trying to convert a class that extends Ext.app.Controller to extending Ext.app.Application. Since Ext.app.Application is a child class of Ext.app.Controller I assumed that simply changing the class being extended would work, instead however, it causes an error in the console that says Uncaught TypeError: Cannot call method 'substring' of undefined. The error occurs at the this.callParent(arguments) inside the constructor: function, Does anyone have any suggestions as to what might be causing this?

Art F
  • 3,992
  • 10
  • 49
  • 81
  • Your description is not enough. Where is it failing (file/line class/method). Can you provide some code to reproduce the problem? – lontivero Dec 21 '12 at 18:08
  • @lontivero I added where it occurs, its a very large class, I am not sure my employer would appreciate me posting it all. I am hoping that perhaps someone experienced something similar. – Art F Dec 21 '12 at 18:11
  • I think with that description is almost impossible help you. Where are you calling the this.callParent methods? Give us some clues. – lontivero Dec 21 '12 at 18:16

1 Answers1

1

You cannot use a constructor within a Ext.app.Application class changes will come with 4.2 but till that use the launch method for example to apply stuff. And do NOT extend.

Application is sort of a singleton instance an get just intialized by calling

Ext.application({
    name: 'MyApp',
    launch: function() {
        Ext.create('Ext.container.Viewport', {
            items: {
                html: 'My App'
            }
        });
    }
});

Trying to run more instances result in problems but you will be able to do this with 4.2 like so

Ext.define('MyApp.Application', {
    extend: 'Ext.app.Application',
    name: 'MyApp'
...
});

Ext.application('MyApp.Application');
sra
  • 23,820
  • 7
  • 55
  • 89