日期:2014-05-16 浏览次数:20671 次
var i = 1;
Ext.onReady(function() {
var newWin = new Ext.Button({
text : "新建窗口",
pressed : true,
handler : function() {
var win = new Ext.Window({
title : "窗口" + (i++),
width : 400,
height : 300,
minimizable : true,
listeners : {
//最小化窗口事件
minimize : function(window) {
window.hide(win.button.id);
window.minimizable = true;
},
close : function(window) {
var delObj = document.getElementById(window.button.id);
delObj.parentNode.parentNode
.removeChild(delObj.parentNode);
}
}
});
win.show(newWin.id);
win.button = new Ext.Button( {
win : win,
id : "id" + i,
text : win.title,
pressed : true,
handler : function(btn) {
if (btn.win.minimizable) {
btn.win.show(btn.id);
btn.win.minimizable = false;
} else {
btn.win.hide(btn.id);
btn.win.minimizable = true;
}
}
});
toolBar.addButton(win.button);
}
});
var toolBar = new Ext.Toolbar( {
height : 25,
renderTo : Ext.getBody(),
items : [ newWin ]
});
})
close : function(window) {
toolBar.remove(window.button);
/*
var delObj = document.getElementById(window.button.id);
delObj.parentNode.parentNode
.removeChild(delObj.parentNode);*/
}