2017-01-06 8 views
2

原因:在等待外部设备/系统回复时,我们需要停止允许解除U/I元素。我尝试了许多不同的方法(keymap,onEsc)。已经有一个工作监听器在外部系统返回数据时解除掩码。这里是因为我有它目前的代码...需要通过对话框调用掩码忽略转义(ExtJS 5.1.2)

onSaveRecord: function() { 
    var me = this; 
    . 
    . 
    . 
    if (me.onRecordSaving(recordDetail, isNew)) { 
     var myMask = new Ext.LoadMask({ 
      msg: 'Processing', 
      target: me.getView(), 
      closable: true, 
      onEsc: function() { my.myOnEsc(); } 
     }); 

     myMask.show(); 
     //me.getView().mask('Processing'); 
     // 
     . 
     . 
     . 
}, 

myOnEsc: function() { 
    debugger; // <--- never hits this 
    Ext.emptyFn(); 
}, 
+0

您正在使用哪种浏览器.Boys onEsc完美无缺。请分享一些小提琴。 – Tejas

+0

我相信在Chrome浏览器上运行。我希望这适合你... https://drive.google.com/open?id=0B_ncyYTZrVeqUXpadDFjcDVNeVE – jtc

回答

1

在actualDialogBox.js这个彼时...

onSaveRecordClick: function() { 
    var me = this; 
    me.callSuper(); 
    var win1 = me.getView(); 
    . 
    . 
    . generic conditional code added 
    . (not pertinent to the escape key disabling). 
    . 
    if (condition) { 
     var win = Ext.WindowManager.getActive(); 
     win.setDisableEscapeKey(true); 
    } 
}, 

,并在上面的对话框的超级...

disableEscapeKey: false, 

setDisableEscapeKey: function (value) { 
    this.disableEscapeKey = value; 
}, 

onEsc: function() { 
    var me = this; 

    if (me.disableEscapeKey) { 
     Ext.emptyFn(); 
    } else { 
     me.callParent(arguments); 
    } 
}, 

完美适用于我的应用程序。