My Dr. Evil application has name
defined as DrEvil
:
Ext.define('DrEvil.Application', {
extend: 'Ext.app.Application',
name: 'DrEvil',
stores: [
// TODO: add global / shared stores here
],
launch: function () {
// TODO - Launch the application
}
});
In my view model, is there a way to retrieve this name? I was hoping something like Ext.app.name
would pull it up but it es up empty. I've been iterating through properties of Ext
, Ext.app
etc. and can't seem to find it.
This is probably something so trivial that it's looking me right in the face, but I did google N variations of ExtJS get name of application within view model with nothing relevant ing up.
I'm trying to convince the pany to purchase the Eclipse plugin for ExtJS! Could probably answer this question in a second.
My Dr. Evil application has name
defined as DrEvil
:
Ext.define('DrEvil.Application', {
extend: 'Ext.app.Application',
name: 'DrEvil',
stores: [
// TODO: add global / shared stores here
],
launch: function () {
// TODO - Launch the application
}
});
In my view model, is there a way to retrieve this name? I was hoping something like Ext.app.name
would pull it up but it es up empty. I've been iterating through properties of Ext
, Ext.app
etc. and can't seem to find it.
This is probably something so trivial that it's looking me right in the face, but I did google N variations of ExtJS get name of application within view model with nothing relevant ing up.
I'm trying to convince the pany to purchase the Eclipse plugin for ExtJS! Could probably answer this question in a second.
Share Improve this question edited Apr 10, 2018 at 11:36 Glorfindel 22.7k13 gold badges90 silver badges119 bronze badges asked Jul 10, 2015 at 17:46 user2191247user21912473 Answers
Reset to default 6It's actually not obvious at all if you assume no knowledge of the application.
This is generic code which will do what you want:
var name = Ext.app.Application.instance.getName();
Or in recent versions of ExtJS:
var name = Ext.getApplication().getName();
You are looking to get the application namespace.
DrEvil.app.getApplication().getName()
If you're using Ext 4+ and create your application using the Ext.application
syntax like so, there will be a reference to your application in the global namespace:
Ext.application({
name: 'DrEvil',
launch: function() {
// do some stuff
}
});
http://docs.extjs./extjs/4.1.3/#!/api/Ext.app.Application
At this point, DrEvil
should be defined in the global scope. Now, you should be able to reference the application name as a string via DrEvil.getApplication().name
, though that might be a bit redundant for what you're looking to do.
Hope this helps.