我有一个工作的网络桌面应用程序,与开箱即用的 ExtJS 桌面示例非常相似,其中有许多图标,单击时会生成一个窗口。
我试图弄清楚如何以编程方式做同样的事情:
var x = Ext.create('MyApp.view.users.Module')
x.launcher.handler();
这会调用 createWindow() 函数,其中的第一行是:
var b = this.app.getDesktop();
这行炸弹:
无法调用未定义的方法“getDesktop”
这显然意味着“this”上没有“app”。
我是 ExtJS 新手,不知道如何将模块绑定到应用程序,或者如何像单击图标那样正确抓取模块。任何帮助,将不胜感激。
模块代码:
Ext.define('MyApp.view.users.Module', {
requires: ["Ext.tab.Panel"],
alias: 'widget.usersmodule',
extend: 'Ext.ux.desktop.Module',
id: 'users-module-win',
itemId: 'usersmodule',
init: function(){
this.launcher = {
handler: this.createWindow,
iconCls: 'icon-users',
scope: this,
text: 'Users',
windowId: 'users-module-win'
}
},
...
createWindow: function(){
var b = this.app.getDesktop();
var a = b.getWindow('users-module-win');
...
a.show();
return a
},
...
});