PDA

View Full Version : Application "name" required checking



amuniz
29 Nov 2013, 6:09 AM
Hello.

I'm getting this error when creating an Ext.app.Application object using Ext.create:


Ext.app.Application.constructor(): [Ext.app.Application] Name property is required

This error is shown only when using ext-dev.js or ext-dev-all.js (it's not thrown using ext-all.js or ext-all-debug.js).

This is my code:



Ext.create('Ext.app.Application', {
name: 'MyApp',
appFolder: 'ui/app',
launch: function() {
...
}
});

The name attribute is actually set, so I think this is a bug in Ext.app.Application constructor (only in dev builds):



constructor: function(config) {
var me = this;

//<debug>
if (Ext.isEmpty(me.name)) {
Ext.Error.raise("[Ext.app.Application] Name property is required");
}
//</debug>

me.callParent(arguments);

me.doInit(me);

me.initNamespace();
me.initControllers();
me.onBeforeLaunch();

me.finishInitControllers();
}

The "debug" section is checking the name BEFORE the callParent, so "me" does not have the "config" object applied yet.

Regards,
Antonio.

Gary Schlosberg
29 Nov 2013, 4:54 PM
Thanks for the report. Can you please post a test case which reproduces the issue? You can use our Fiddle (https://fiddle.sencha.com/#home) if you like.

amuniz
2 Dec 2013, 1:03 PM
Hello Gary,

Sure.
How can I include ext-dev.js in your Fiddle?

Regards,
Antonio.

nohuhu
3 Dec 2013, 1:43 PM
@amuniz You're not supposed to create an instance of Ext.app.Application; subclass it and instantiate the derived class instead:


Ext.define('MyApp.Application', {
extend: 'Ext.app.Application',

name: 'MyApp',
...
});

Ext.create('MyApp.Application'); // Or just `new MyApp.Application()`


Regards,
Alex.