Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.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 ExtJS 6-隐藏组件时停止事件委派?_Javascript_Extjs_Extjs6_Event Delegation - Fatal编程技术网

Javascript ExtJS 6-隐藏组件时停止事件委派?

Javascript ExtJS 6-隐藏组件时停止事件委派?,javascript,extjs,extjs6,event-delegation,Javascript,Extjs,Extjs6,Event Delegation,我必须在模糊事件中隐藏相同的字段 Extjs 6在组件隐藏方法上调用事件委派。事件委派将焦点还原到具有焦点的最后一个字段 而且,我不想让这个焦点恢复。在extjs中隐藏元素时,有没有办法停止事件委派 事件委派随extjs 5提供- 用于隐藏的方法- ExtJS源代码中的onHide()方法-检查revertFocus() 当模糊事件触发时,在viewcontroller中调用的函数中使用suspendEvents和resumeEvents: 它不是stopEvents而是suspendEvent

我必须在模糊事件中隐藏相同的字段

Extjs 6在组件隐藏方法上调用事件委派。
事件委派将焦点还原到具有焦点的最后一个字段

而且,我不想让这个焦点恢复。在extjs中隐藏元素时,有没有办法停止事件委派

事件委派随extjs 5提供-

用于隐藏的方法-

ExtJS源代码中的onHide()方法-检查revertFocus()


当模糊事件触发时,在viewcontroller中调用的函数中使用
suspendEvents
resumeEvents

它不是
stopEvents
而是
suspendEvents
。我的错P

blurEventFunction:function(cmp){
    cmp.suspendEvents();
    cmp.hide();
    camp.resumeEvents();
}

当模糊事件触发时,在viewcontroller中调用的函数中使用
suspendEvents
resumeEvents

它不是
stopEvents
而是
suspendEvents
。我的错P

blurEventFunction:function(cmp){
    cmp.suspendEvents();
    cmp.hide();
    camp.resumeEvents();
}

您做错了,
revertFocus()
是一个主要问题源。解决办法可能是:

blurEventFunction:function(cmp){
    cmp.previousFocus = null;
    cmp.hide();
}

您做错了,
revertFocus()
是一个主要问题源。解决办法可能是:

blurEventFunction:function(cmp){
    cmp.previousFocus = null;
    cmp.hide();
}
我也有同样的问题。(extjs 6.5.1-使用带有closeAction的模式窗口:“隐藏”)

我在调试代码,似乎是因为最新的字段集中在一个面板中,而我的模式窗口不是该面板的子窗口。 (似乎extjs获得了模态窗口的祖先以查找最新的聚焦字段,然后设置聚焦)

当我把窗户添加到面板上时,它工作得很好。(当模式窗口关闭时,焦点在打开窗口之前聚焦的最新字段上)

在调试Ext.util.Focusable类时,我看到了一个名为preventRefocus的配置。如果将值为true的配置添加到模式窗口中,则不会执行revertFocus函数的内容,也不会出现错误

revertFocus: function() {
        var me = this,
            focusEvent = me.focusEnterEvent,
            activeElement = Ext.Element.getActiveElement(),
            focusTarget, fromComponent, reverted;

        // If we have a record of where focus arrived from, 
        //  and have not been told to avoid refocusing, 
        //  and we contain the activeElement. 
        // Then, before hiding, restore focus to what was focused before we were focused. 

        // --->>> THE IF BELOW: !me.preventRefocus <<<---

        if (focusEvent && !me.preventRefocus && me.el.contains(activeElement)) {
revertFocus:function(){
var me=这个,
focusEvent=me.FocusInterEvent,
activeElement=Ext.Element.getActiveElement(),
focusTarget,fromComponent,已还原;
//如果我们有focus从哪里来的记录,
//没有被告知要避免重新聚焦,
//我们包含activeElement。
//然后,在隐藏之前,将焦点恢复到我们聚焦之前的焦点。
//-->>>下面的IF:!me.preventRefocus我遇到了相同的问题。(extjs 6.5.1-使用带有closeAction的模式窗口:“hide”)

我在调试代码,似乎是因为最新的字段集中在一个面板中,而我的模式窗口不是该面板的子窗口。 (似乎extjs获得了模态窗口的祖先以查找最新的聚焦字段,然后设置聚焦)

当我将窗口添加到面板时,它工作得很好(当模式窗口关闭时,焦点在打开窗口之前聚焦的最新字段上)

在调试Ext.util.Focusable类时,我看到了一个名为preventRefocus的配置。如果将该配置的值添加到模式窗口中,则不会执行revertFocus函数的内容,也不会出现错误

revertFocus: function() {
        var me = this,
            focusEvent = me.focusEnterEvent,
            activeElement = Ext.Element.getActiveElement(),
            focusTarget, fromComponent, reverted;

        // If we have a record of where focus arrived from, 
        //  and have not been told to avoid refocusing, 
        //  and we contain the activeElement. 
        // Then, before hiding, restore focus to what was focused before we were focused. 

        // --->>> THE IF BELOW: !me.preventRefocus <<<---

        if (focusEvent && !me.preventRefocus && me.el.contains(activeElement)) {
revertFocus:function(){
var me=这个,
focusEvent=me.FocusInterEvent,
activeElement=Ext.Element.getActiveElement(),
focusTarget,fromComponent,已还原;
//如果我们有focus从哪里来的记录,
//没有被告知要避免重新聚焦,
//我们包含activeElement。
//然后,在隐藏之前,将焦点恢复到我们聚焦之前的焦点。

//-->>>下面的IF:!me.preventRefocus如果我不对请纠正我,你想在组件触发事件时实现这一点吗
blur
也用
hide
事件隐藏自己?在这种情况下,你是否尝试过
stopEvents/resumeEvents
?你理解得对。
component.hide()
我正在使用的方法..我应该把这个
stopEvents/resumeEvents
放在哪里?如果我不正确,请纠正我?当组件触发事件
blur
时,您想实现这一点,并且用
hide
事件隐藏自己吗?在这种情况下,您尝试过
stopEvents/resumeEvents
?您理解得对。
 component.hide()
我正在使用的方法..我应该把这个
stopEvents/resumeEvents
放在哪里?没有成功..仍然恢复焦点方法被调用我已经更新了我的问题-从extjs源代码复制了onHide()方法,显示了revertfoucs()获取调用anywayno success..仍然还原焦点方法获取调用我已经更新了我的问题-从extjs源复制了onHide()方法,显示revertfoucs()不管怎样都会被呼叫谢谢你的直接指导。你是对的。但是在
extjs 6
中需要额外一行来停止事件委派。更新了你的答案并被接受。谢谢你的直接指导。你是对的。但是在
extjs 6
中需要额外一行来停止事件委派。更新了你的答案并被接受。