从组合框中删除键入光标

me1*_*111 7 combobox extjs cursor listener

我正在使用ExtJS组合框.聚焦于组合框时有一个打字光标.我editable: false在创建组合框时尝试实现,但它只对chrome有帮助.

还试过clearListeners()功能,看看这是否适用于该光标 - 没有帮助,它仍然出现在FireFox和IE中.

另一个想法是disabled在组合框中设置输入字段.当我手动完成时,它有所帮助.

但是当我写下一个

Ext.get('bu-encodingcount-combobox').select('input').set({disabled:'disabled'});

它没有帮助 - 不知道,也许表达是错误的.

Aci*_*ier 12

您看到光标的原因是因为组合框获得了焦点,因此处理此问题的最简单方法是在组合获得焦点时将焦点移动到下拉选取器上.

只需将此onFocus配置添加到您的组合框配置:

// example combobox config
xtype: 'combo',
allowBlank: false,
forceSelection: true,
valueField:'id',
displayField:'name',
store: myStore,

// add this "onFocus" config
onFocus: function() {
    var me = this;

    if (!me.isExpanded) {
        me.expand()
    }
    me.getPicker().focus();
},
Run Code Online (Sandbox Code Playgroud)

另外,如果这是一个forceSelection: true组合框,我只建议这样做.它会破坏用户在字段中输入任何内容的能力.


Ani*_*ran 5

您可以添加配置,

可编辑:假

然后表现为正常的 Combo 。