Extjs 新建窗口并监听子窗口关闭事件

function gridOpenNewWin(url,title){
	var isFistRestore=0;
	var html = "";
	var fatherStyle = Ext.getBody();
	var bodyWidth =  fatherStyle.getComputedWidth();
	var bodyHeight = fatherStyle.getComputedHeight();
	
	var winId;
	var i;
	for(i=0;i<=WinPosition;)
	{
		winId = "win"+i;
		if(Ext.getCmp(winId))
		{
			i++;
		}
		else{
			if(title.length<1)
				title = '查看窗口'+i;
			var tabs = new Ext.Panel({
					region: 'center',
					margins:'3 3 3 0', 
					defaults:{autoScroll:true},
					html: html
				});
			win = new Ext.Window({
				title:title,
				closable:true,
				maximizable:true,
				width:bodyWidth,
				height:bodyHeight,
				border:false,
				plain:true,
				//modal:true,
				id:winId,
				constrain :true,
				layout: 'border',
				items: [tabs]
			});
			win.show(fatherStyle);
//			win.minimize();
			win.maximize(); 
			win.on('restore', function(){
				if(isFistRestore==0)
				{
					win.setPosition(bodyWidth-i*30-30,0);
					isFistRestore=1;
				}
			});	
			win.on('close', function(){
					window.location.reload() ;
			});	
			if(i==WinPosition)
				WinPosition++;
			break;
		}
	}
}


你可能感兴趣的:(extjs)