ComboBox in IE 10/11 be focus [closed]

懵懂的女人 提交于 2019-12-13 10:23:56

问题


Ext version: 5.1.0.107 Browser: IE 10/11

While i create a ComboBox with a value, the ComboBox will be focus after it was rendered.

demo: http://ift.tt/1326fZR

How can i resolve this problem?


回答1:


Solution you can find here:

https://www.sencha.com/forum/showthread.php?296103-ComboBox-in-IE-10-11-be-focus

Ext.define('Ext.overrides.form.field.ComboBox', {
     override: 'Ext.form.field.ComboBox',

     // OVERRIDE
     checkChangeEvents : Ext.isIE ? 
                    ['change', 'propertychange', 'keyup'] :
                    ['change', 'input', 'textInput', 'keyup', 'dragdrop']
});



回答2:


For me it worked after I have override something more.

Ext.override(Ext.form.field.Base, {
    initEvents: function() {
        var me = this,
        inputEl = me.inputEl,
            onFieldMutation = me.onFieldMutation,
            events = me.checkChangeEvents,
            len = events.length,
            i, event;
        if (inputEl) {
            me.mon(inputEl, Ext.supports.SpecialKeyDownRepeat ? 'keydown' : 'keypress', me.fireKey, me);
            for (i = 0; i < len; ++i) {
                event = events[i];
                if (event === 'propertychange') {
                    me.usesPropertychange = true;
                }
                if (event === 'textInput') {
                    me.usesTextInput = true;
                }
                me.mon(inputEl, event, onFieldMutation, me);
            }
        }
        me.callParent();
    },

    bindPropertyChange: function(active) {
        var method = active ? 'resumeEvent' : 'suspendEvent',
            inputEl = this.inputEl;
        if (this.usesPropertychange) {
            inputEl[method]('propertychange');
        }
        if (this.usesTextInput) {
            inputEl[method]('textInput');
        }
    }
});

This part is copied from version 5.1.1.451 where bug is already fixed.



来源:https://stackoverflow.com/questions/30053309/combobox-in-ie-10-11-be-focus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!