【问题标题】:jQuery EasyUI: confirmation on close windowjQuery EasyUI:关闭窗口确认
【发布时间】:2013-06-12 06:04:44
【问题描述】:

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

我该怎么做?

【问题讨论】:

    标签: javascript jquery jquery-ui jquery-easyui


    【解决方案1】:

    试试

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

    Messanger API

    【讨论】:

    • 如何在窗口关闭事件中设置它?
    【解决方案2】:

    试试这个,

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

    【讨论】:

      【解决方案3】:

      此功能并非由 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
                          {
      
                          }
      
                  }  
              }]  
          });  
      

      【讨论】:

        【解决方案4】:

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

        还设置关闭按钮类。

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

        请试试这个。

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

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-04-29
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多