Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/411.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery EasyUI:关闭窗口的确认_Javascript_Jquery_Jquery Ui_Jquery Easyui - Fatal编程技术网

Javascript jQuery EasyUI:关闭窗口的确认

Javascript jQuery EasyUI:关闭窗口的确认,javascript,jquery,jquery-ui,jquery-easyui,Javascript,Jquery,Jquery Ui,Jquery Easyui,我正在使用jQueryEasyui框架。我想要一条关于关闭窗口的确认消息,如“您确定要关闭窗口吗?”。如果答案为“真”,则关闭“否则不关闭”窗口 我该怎么做呢?试试看 $.messager.confirm('Confirm', 'Are you sure to exit this system?', function(r){ if (r){ // exit action; } }); 请参见试试这个 $('#windowid').window({ onBefor

我正在使用jQueryEasyui框架。我想要一条关于关闭窗口的确认消息,如“您确定要关闭窗口吗?”。如果答案为“真”,则关闭“否则不关闭”窗口

我该怎么做呢?

试试看

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

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

此功能不是由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
                    {

                    }

            }  
        }]  
    });  

easy ui不提供此功能。 因此,您必须隐藏或设置关闭按钮的css显示属性set none

还可以设置关闭按钮类

.panel-tool-close
    {
        display:none !important;
    } 
请试试这个

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

                    }

            }  
        }]  

如何将其设置为窗口的关闭事件?