Ext window关闭 我想在Window关闭时(点击右上角的"X"),弹出提示框,由用户确认是否关闭窗口,这样该如何实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 window.onbeforeunload = function() { try { return "是否关闭?"; } catch (e) { } } window事件属性 例如你的window的实例是win那么 beforeclose 事件就可以了win.on('beforeclose',function(){ return confirm('是否关闭');});赶紧结贴吧 这样好像不行吧,Ext的Api的window事件中没有onbeforeunload 这个事件呀! 回复于:2011-06-30 15:13:20例如你的window的实例是win那么 beforeclose 事件就可以了win.on('beforeclose',function(){ return confirm('是否关闭');});赶紧结贴吧 这个也是了,就是不行的?是否还有什么属性要设置吗? Ext.onReady(function () { Ext.create('Ext.window.Window', { title: 'Hello', height: 200, width: 400, listeners: { beforeClose: function (_this) { return confirm("确认删除吗?"); } } }).show(); }); var codeWindow = new Ext.Window( { layout : 'fit', width : 300, height : 200, resizable : false, draggable : true, closeAction : 'hide', title : '<span style="font-weight:normal">新增层面</span>', // iconCls : 'page_addIcon', modal : true, collapsible : false, closable:true, listeners:{ beforeClose:function(){ return confirm("确认关闭吗?"); } }, titleCollapse : true, maximizable : false, buttonAlign : 'right', border : false, animCollapse : true, animateTarget : Ext.getBody(), constrain : true, items : [ formPanel ], buttons : [ { text : '保存', iconCls : 'acceptIcon', handler : function() { if (codeWindow.getComponent('dataSourceForm').form.isValid()) { Ext.Msg.confirm('提示','确认要新增层面吗?',function(btn,text){ if(btn=='yes'){ codeWindow.getComponent('dataSourceForm').form.submit( { url : './sjjType.ered?reqCode=saveDivlay', waitTitle : '提示', method : 'POST', waitMsg : '正在处理数据,请稍候...', success : function(form,action) { store.reload(); var msg = action.result.msg; Ext.MessageBox.alert('提示',msg); codeWindow.hide(); }, failure : function(form,action) { var msg = action.result.msg; Ext.MessageBox.alert('提示',msg); codeWindow.getComponent('dataSourceForm').form.reset(); } }); } }); } else { // 表单验证失败 } } }, { text : '重置', id : 'btnReset', iconCls : 'tbar_synchronizeIcon', handler : function() { clearForm(formPanel.getForm()); } },{ text : '关闭', iconCls : 'deleteIcon', handler : function() { Ext.Msg.confirm('确认','确认退出该窗口吗?',function (btn,text){ if(btn=='yes') { codeWindow.hide(); } }); } } ] }); codeWindow.on('beforeClose',function(){ return confirm("确认关闭?"); });我这两种方式用了,貌似还是不行? 找到原因了,closeAction : 'hide',这个属性是hide,应该用beforehide事件,或是把closeAction:'close'; 请提供js动画的网址! js的IDE推荐 怎么获取网页元素input外面得一个SPAN标记里面的一个值? 如何查找字符串里里面的反斜杠 非常简单的问题?!!!!!!!!!!! 非贪婪匹配的问题 关于javascript操作时遇到的怪问题 小妹急.........,求一取字符串语句,在线等!!! 如何实现单击按钮跳转到某一界面的功能 一个无耻的网站强行 window.functionName = new Function() 有什么特别吗? setTimeout()为啥停不下来?
try {
return "是否关闭?";
} catch (e) { }
}
return confirm('是否关闭');
});赶紧结贴吧
return confirm('是否关闭');
});赶紧结贴吧
这个也是了,就是不行的?是否还有什么属性要设置吗?
Ext.onReady(function () {
Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
listeners: {
beforeClose: function (_this) {
return confirm("确认删除吗?");
}
} }).show();
});
{
layout : 'fit',
width : 300,
height : 200,
resizable : false,
draggable : true,
closeAction : 'hide',
title : '<span style="font-weight:normal">新增层面</span>',
// iconCls : 'page_addIcon',
modal : true,
collapsible : false,
closable:true,
listeners:{
beforeClose:function(){
return confirm("确认关闭吗?");
}
},
titleCollapse : true,
maximizable : false,
buttonAlign : 'right',
border : false,
animCollapse : true,
animateTarget : Ext.getBody(),
constrain : true,
items : [ formPanel ],
buttons : [
{
text : '保存',
iconCls : 'acceptIcon',
handler : function() {
if (codeWindow.getComponent('dataSourceForm').form.isValid()) {
Ext.Msg.confirm('提示','确认要新增层面吗?',function(btn,text){
if(btn=='yes'){
codeWindow.getComponent('dataSourceForm').form.submit( {
url : './sjjType.ered?reqCode=saveDivlay',
waitTitle : '提示',
method : 'POST',
waitMsg : '正在处理数据,请稍候...',
success : function(form,action) {
store.reload();
var msg = action.result.msg;
Ext.MessageBox.alert('提示',msg);
codeWindow.hide();
},
failure : function(form,action) {
var msg = action.result.msg;
Ext.MessageBox.alert('提示',msg);
codeWindow.getComponent('dataSourceForm').form.reset();
}
});
}
});
} else {
// 表单验证失败
}
}
}, {
text : '重置',
id : 'btnReset',
iconCls : 'tbar_synchronizeIcon',
handler : function() {
clearForm(formPanel.getForm());
}
},{
text : '关闭',
iconCls : 'deleteIcon',
handler : function() {
Ext.Msg.confirm('确认','确认退出该窗口吗?',function (btn,text){
if(btn=='yes')
{
codeWindow.hide();
}
});
}
} ]
});
codeWindow.on('beforeClose',function(){
return confirm("确认关闭?");
});
我这两种方式用了,貌似还是不行?