在extjs自己带的例子里是桌面图标对应的关联是一级菜单事件。
MyDesktop.GridWindow = Ext.extend(Ext.app.Module, {
id:'grid-win', //这里定义了ID,到desktop.html可以关联
init : function(){
this.launcher = {
text: 'Grid Window',
iconCls:'icon-grid',
handler : this.createWindow,
scope: this
}
},
createWindow : function(){
var desktop = this.app.getDesktop();
var win = desktop.getWindow('grid-win');
if(!win){
win = desktop.createWindow({
id: 'grid-win',
title:'Grid Window',
width:740,
height:480,
iconCls: 'icon-grid',
shim:false,
animCollapse:false,
constrainHeader:true,
layout: 'fit',
items:
new Ext.grid.GridPanel({
省略。。。。。 })
win.show();
}
});
对应的desktop.html中
[size=large][b]以上没有问题[/b][/size]
[b][size=x-large]问题如下:
但现在做了二级菜单:[/size][/b]
var windowIndex = 0;
MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {
init : function(){
this.launcher = {
text: 'Window '+(++windowIndex),
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId:windowIndex
}
},
createWindow : function(src){
var desktop = this.app.getDesktop();
var win = desktop.getWindow('bogus'+src.windowId);
if(!win){
win = desktop.createWindow({
id: 'bogus'+src.windowId,
title:src.text,
width:640,
height:480,
html : '<p>Something useful would be in here.</p>',
iconCls: 'bogus',
shim:false,
animCollapse:false,
constrainHeader:true
});
}
win.show();
}
});
MyDesktop.CollegeMenuModule = Ext.extend(MyDesktop.BogusModule, {
init : function(){
this.launcher = {
iconCls: 'x-icon-waiting',
scope: this,
shortcutIconCls: 'demo-bogus-shortcut',
text: ' 构建111',
handler: function() {
return false;
},
menu: {
items:[{
text: 'GOOGLE库'+(++windowIndex),
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId: windowIndex
},{
text: 'WEB库 '+(++windowIndex),
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId: windowIndex
},{
text: '测试库 '+(++windowIndex),
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId: windowIndex
} ]
}
}}
});
[size=large][b] [color=red]这样的话在 desktop.html中该怎么写啊?ID这个怎么写,请教。想关联到 'WEB库 '[/color] [/b][/size]