浏览器改变大小的时候,实现Extjs中的window控件在页面上始终居中
var currentWindow;
Ext.EventManager.onWindowResize(function(){
if(currentWindow){
currentWindow.setHeight(document.body.clientHeight * 0.8 );
currentWindow.setWidth(document.body.clientWidth * 0.8 );
currentWindow.center();
}
});
//Ext.EventManager.onWindowResize(abcresize);
var win = new Ext.Window({
title : 'Layout Window',
closable : true,
width : 600,
height : 350,
//border : false,
plain : true,
layout : 'border',
items : [nav, tabs]
});
win.addListener('beforeshow',function(o){
currentWindow=o;
});
win.addListener('destroy',function(o){
currentWindow=null;
});
win.show(button);