如何从视图中获取我的应用程序?例如,考虑我有一个应用程序,Boo并且有一个名为的视图,Boo.view.Foo.List我想进入Boo视图List.
编辑:
请参阅此代码,并查看第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);
}
});
Run Code Online (Sandbox Code Playgroud)
sra*_*sra 10
您可以使用appProperty来实现此目的
Ext.application({
name: 'MyApp',
appProperty: 'Current'
});
Run Code Online (Sandbox Code Playgroud)
你现在可以打电话了
MyApp.Current
Run Code Online (Sandbox Code Playgroud)
从任何地方导致MyApp命名空间在窗口(全局)范围内抵制.
对于4.1.3之前的任何版本,将以下行添加到应用程序的启动方法中
YourAppName[this.appProperty] = this;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9799 次 |
| 最近记录: |