Art F
Art F

Reputation: 4202

ExtJS convering an Ext.app.Controller to an Ext.app.Application

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?

Upvotes: 0

Views: 503

Answers (1)

sra
sra

Reputation: 23975

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');

Upvotes: 1

Related Questions