ExtJS让被遮盖的窗体显示在最前面以及解决Ext.MessageBox提示框被TabPanel覆盖的方法

发布于 2011-07-28 | 更新于 2020-09-20

一、如何让ExtJS的弹出提示信息框Ext.MessageBox或者创建的Ext.Window显示在最前面:

下面是显示一个Window的JS代码:

var formPanel = MisTab1.createAddFormPanel();
var addWin = new Ext.Window({
title: “添加产品类别”,
pageX: 50,
pageY: 50,
width: 600,
height: 200,
plain: true,
resizable: false,
collapsible: true,
closeAction: ‘close’,
closable: true,
modal: ‘true’,
buttonAlign: “center”,
bodyStyle: “padding:20px 0 0 0”,
alwaysOnTop: true,
items: [formPanel],
buttons: [{
text: “添 加”,
minWidth: 70,
handler: function() {
}
}, {
text: “关 闭”,
minWidth: 70,
handler: function() {
}
}]
});
addWin.show();

效果如图:

想要让Window显示在最前面,只要创建一个WindowGroup管理创建的Window即可,需要添加的代码如下:

var tab1GroupMgr = new Ext.WindowGroup();
//前置窗口
tab1GroupMgr.zseed=99999;

var addWin = new Ext.Window({
title: “添加产品类别”,
pageX: 50,
pageY: 50,
width: 600,
height: 200,
plain: true,
manager: tab1GroupMgr,

二、ExtJS弹出提示信息框Ext.MessageBox或者创建的Ext.Window被Ext.TabPanel覆盖的解决方法

出现这种原因可能是因为TabPanel设置了floating:true配置项。

floating : Boolean True表示为浮动此面板(带有自动填充和投影的绝对定位),false… True表示为浮动此面板(带有自动填充和投影的绝对定位),false表示为在其渲染的位置"就近"显示(默认为false)。True to float this Panel (absolute position it with automatic shimming and shadow), false to display it inline where it is rendered (defaults to false).

解决方法就是把设置的floationg:true配置项去掉:

var tabPanel = new Ext.TabPanel({
region: ‘center’,
activeTab:0,
shadow: true,
floating: true, //去掉该配置项
items: [{
title: ‘欢迎页面’
}]
});

本文作者: arthinking

本文链接: https://www.itzhai.comextjs-form-to-be-displayed-on-the-front-cover-and-solve-ext-messagebox-boxes-are-covered-by-the-method-tabpanel.html

版权声明: 版权归作者所有,未经许可不得转载,侵权必究!联系作者请加公众号。

×
IT宅

关注公众号及时获取网站内容更新。