admin管理员组文章数量:1392893
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.
本文标签: javascriptExt JSHow to get name of application from within ViewModelStack Overflow
版权声明:本文标题:javascript - Ext JS - How to get name of application from within ViewModel? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744784466a2624911.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论