jQuery EasyUI:关闭窗口确认

时间:2013-06-12 06:04:44

标签: javascript jquery jquery-ui jquery-easyui

我正在使用jQuery EasyUI框架。我想要关闭窗口上的确认消息,例如“你确定要关闭窗口吗?”。如果答案为真,则关闭其他不关闭窗口。

我该怎么做?

4 个答案:

答案 0 :(得分:1)

尝试

$.messager.confirm('Confirm', 'Are you sure to exit this system?', function(r){
    if (r){
        // exit action;
    }
});

请参阅Messanger API

答案 1 :(得分:1)

试试这个,

$('#windowid').window({
onBeforeClose: function(){
    $.messager.confirm('Confirm', 'Are you sure to exit this system?', function(r)
            {
             if (r){
                  return true;
              }
             else{return false;}
            });                    
}
});

答案 2 :(得分:0)

此功能不是由Easy-UI直接提供的 如果你想,那么你需要禁用窗口的关闭按钮

.panel-tool-close
    {
        display:none !important;
    } 

并添加自定义工具栏 在document.ready函数中就像这样。

jQuery('#divSeguimientos').window({  
        collapsible:false,  
        minimizable:false,  
        maximizable:false,  
        tools:[{  
            iconCls:'icon-cancel',  
            handler:function(){  
                if(confirm('Are you sure to close the window?'))
                    {
                        closeDivSeguimientos();
                    }
                    else
                    {

                    }

            }  
        }]  
    });  

答案 3 :(得分:0)

easy ui不提供此功能。 所以你必须隐藏或设置关闭按钮设置为无的css显示属性。

还设置关闭按钮类。

.panel-tool-close
    {
        display:none !important;
    } 

请试试这个。

tools:[{  
            iconCls:'icon-cancel',  
            handler:function(){  
                if(confirm('Are you sure to close?'))
                    {
                        closeDiv();
                    }
                    else
                    {

                    }

            }  
        }]