如何从应用程序中获取视图? [英] How to get application from view?
本文介绍了如何从应用程序中获取视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从视图中获取我的应用程序?
例如考虑我有一个应用程序 Boo
,并有一个名为 Boo.view.Foo.List
我想在视图列表
中获取 Boo
。
How can I get my application from a view?
For example consider I have an application Boo
and there's a view that named Boo.view.Foo.List
and I want to get Boo
in the view List
.
编辑:
查看此代码,并查看第20行。
See this code, and look at the line 20.
Ext.define('Boo.view.Foo.List', {
extend: 'Ext.panel.Panel',
model: 'Boo.model.FooModel',
alias: 'widget.foolist',
store: 'FooListStore',
initComponent: function () {
this.columns = [
{
text: "Hello world",
dataIndex: 'Time',
flex: 1
},
{
xtype: 'actioncolumn',
width: 50,
items: [{
icon: 'cancel.png',
tooltip: 'Cancel',
handler: function (grid, rowIndex, colIndex, col, e) {
//Now I need to get the application here, for example with self.getApplication() or something like this.
}
}]
}];
this.callParent(arguments);
}
});
推荐答案
您可以使用 appProperty
You can archieve this using the appProperty
Ext.application({
name: 'MyApp',
appProperty: 'Current'
});
现在可以调用
MyApp.Current
从任何地方导致 MyApp
命名空间在窗口(全局)范围内抵抗。
from anywhere cause the MyApp
namespace resist within the window (global) scope.
对于4.1.3之前的任何版本,将以下行添加到启动方法应用程序
For any Version before 4.1.3 add the following line to the Launch-Method of the Application
YourAppName[this.appProperty] = this;
这篇关于如何从应用程序中获取视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文