Javascript 组合不';手动移动焦距时不会模糊

Javascript 组合不';手动移动焦距时不会模糊,javascript,extjs,extjs3,Javascript,Extjs,Extjs3,我有一个组合框,可以在用户选择一个值后立即将焦点转移到另一个表单元素,配置如下: new Ext.form.ComboBox({ // ... listeners: { select: function( a, record ) { if ( typeof( record ) == 'undefined' ) { return; } if ( !Ext.get

我有一个组合框,可以在用户选择一个值后立即将焦点转移到另一个表单元素,配置如下:

new Ext.form.ComboBox({
    // ...
    listeners: {
        select: function( a, record ) {
            if ( typeof( record ) == 'undefined' ) {
                return;
            }

            if ( !Ext.getCmp('input-name').getValue() ) {
                Ext.getCmp('input-name').focus();
            }
        },
        blur: function() {
            console.log('blurred');
        },
        render: function( field ) {
            if ( !config.activity ) {
                field.onTriggerClick();
            }
        }
    },
    // ...
});
然而,一件奇怪的事情发生了。“输入名称”表单字段接收焦点,我可以开始输入,但组合字段从不模糊。它仍然具有“x-form-focus”样式,“blur”事件从未触发。只有当我使用鼠标单击另一个字段时,组合才会模糊


有人知道发生了什么吗?我怎样才能避免这种情况?

当任何一段代码作为事件的一部分执行,并导致触发其他事件时,新事件就不会被触发。
只有当用户在UI中执行某些操作时,才应执行onBlur,因为组合框会失去焦点,而不是通过编程方式使字段失去焦点。

我就是这样解决的:

listeners: {
    select: function( a, record ) {
        if ( typeof( record ) == 'undefined' ) {
            return;
        }

        /**
         * There's some weird stuff going on in the combo control, that causes it not to blur when shifting focus,
         * so we have to do it manually. This action has to be deferred, because the control is going to refocus 
         * itself at the end of the function firing this event (onViewClick()).
         */
        this.moveFocus.defer( 100, this );
    },
    render: function( field ) {
        field.moveFocus = function() {
            if ( !Ext.getCmp('input-name').getValue() ) {
                Ext.getCmp('input-name').focus();
                this.triggerBlur();
            }
        };

        if ( !config.activity ) {
            field.onTriggerClick();
        }
    }
},