解决多层窗口固定层次的问题非常简单,你只需要将每个window的setZIndex设置成空函数就行了,例如:
[code="js"]
new Ext.Window({
setZIndex:Ext.emptyFn,
...
[/code]
我看你的代码发现问题太多了,你的window没有重用,销毁时没有进行注册,还有那个逻辑实在太复杂了点,我写了一个你参考下吧
[code="js"]
/**
Ext.ux.TbarCombo = Ext.extend(Ext.form.ComboBox, {
initList: function(){
this.title = '<div id="addbutton" style="height:20px"></div>';
Ext.ux.TbarCombo.superclass.initList.call(this);
this.addBtn = new Ext.Button({
renderTo: 'addbutton',
text: '新增',
handler: this.showWin,
scope: this
})
},
showWin: function(){
if (!this.win) {
this.win = new Ext.Window({
animateTarget: this.addBtn.el,
closeAction: 'hide',
title: '添加',
width: 200,
layout: 'form',
labelWidth: 60,
bodyStyle: {
padding: '10px'
},
items: {
ref: 'input',
anchor: '90%',
emptyText: '请输入',
xtype: 'textfield',
fieldLabel: '新增属性'
},
buttons: [{
text: '保存',
handler: this.doSave,
scope: this
}],
setZIndex: Ext.emptyFn,
buttonAlign: 'center'
});
}
else {
this.win.input.reset();
}
this.win.show();
},
doSave: function(){
var val = this.win.input.getValue();
this.getStore().loadData([val], true);
Ext.MessageBox.show({
msg: "保存",
icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK
});
this.win.hide();
},
getParentZIndex: function(){//这里让它大一些 list就不会因为window的zindex变化而隐藏了
return Ext.ux.TbarCombo.superclass.getParentZIndex.call(this) + 10;
},
postBlur: Ext.emptyFn,
collapseIf: Ext.emptyFn,
onDestroy: function(){
Ext.destroy(this.win);
Ext.ux.TbarCombo.superclass.onDestroy.call(this);
}
});
Ext.reg('tbarcombo', Ext.ux.TbarCombo);
Ext.onReady(function(){
Ext.QuickTips.init();
var win = new Ext.Window({
title: '测试',
height: 300,
draggable: false,
width: 300,
items: {
xtype: 'tbarcombo',
setZIndex: Ext.emptyFn,
emptyText: '请选择',
store: ['属性1', '属性2', '属性3', '属性4'],
allowBlank: false,
forceSelection: true,
triggerAction: 'all'
}
});
new Ext.Viewport({
listeners: {
afterrender: function(){
win.show();
}
}
});
});
[/code]
找个页面放进去跑一下你就明白了