【发布时间】:2016-04-18 07:06:07
【问题描述】:
我必须在它的模糊事件中隐藏相同的字段。
Extjs 6 在组件隐藏方法上调用事件委托。Event delegation revert focus to last field which had focus。
而且,我不希望这种恢复焦点。有什么办法可以stop event delegation 在 extjs 中隐藏元素?
extjs 5 自带事件委托 - Delegated Events and Gestures in Ext JS 5
用于隐藏的方法 - https://docs.sencha.com/extjs/6.0/6.0.1-classic/#!/api/Ext.Component-method-onHide
ExtJS 源代码中的 onHide() 方法 - 检查 revertFocus()
onHide: function(animateTarget, cb, scope) {
var me = this,
ghostPanel, fromSize, toBox;
if (!me.ariaStaticRoles[me.ariaRole]) {
me.ariaEl.dom.setAttribute('aria-hidden', true);
}
// Part of the Focusable mixin API.
// If we have focus now, move focus back to whatever had it before.
me.revertFocus(); // this revert focus making probelm
// Default to configured animate target if none passed
animateTarget = me.getAnimateTarget(animateTarget);
// Need to be able to ghost the Component
if (!me.ghost) {
animateTarget = null;
}
// If we're animating, kick off an animation of the ghost down to the target
if (animateTarget) {
toBox = {
x: animateTarget.getX(),
y: animateTarget.getY(),
width: animateTarget.dom.offsetWidth,
height: animateTarget.dom.offsetHeight
};
ghostPanel = me.ghost();
ghostPanel.el.stopAnimation();
fromSize = me.getSize();
ghostPanel.el.animate({
to: toBox,
listeners: {
afteranimate: function() {
delete ghostPanel.componentLayout.lastComponentSize;
ghostPanel.el.hide();
ghostPanel.setHiddenState(true);
ghostPanel.el.setSize(fromSize);
me.afterHide(cb, scope);
}
}
});
}
me.el.hide();
if (!animateTarget) {
me.afterHide(cb, scope);
}
},
【问题讨论】:
-
如果我说的不对,请纠正我,¿您想在组件触发事件时实现这一点
blur也用hide事件隐藏自己?在这种情况下,您是否尝试过使用stopEvents/resumeEvents? -
你理解对了..
component.hide()我正在使用的方法..我应该把这个stopEvents/resumeEvents放在哪里?
标签: javascript extjs extjs6 event-delegation