Remove typing cursor from combobox

后端 未结 3 1018
一生所求
一生所求 2020-12-18 01:15

I am using an ExtJS combobox. There is a typing cursor when focusing on the combobox. I tried to implement editable: false when creating the combobox, but it he

相关标签:
3条回答
  • 2020-12-18 01:43

    The reason you see a cursor is because the combobox gets the focus, so the easiest way to handle this is to move the focus onto the drop down picker whenever the combo gets the focus.

    Simply add this onFocus config to your combobox configuration:

    // 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();
    },
    

    Also, I would only recommend doing this if this is a forceSelection: true combobox. It will ruin a users ability to type anything into the field.

    0 讨论(0)
  • 2020-12-18 01:46

    You can add the config,

    editable:false

    Then behaves as the normal Combo .

    0 讨论(0)
  • 2020-12-18 02:04

    Try -

    For IE

    combo.inputEl.set({disabled:'disabled'});

    For Firefox -

    combo.inputWrap.set({disabled:'disabled'});

    For Chrome -

    combo.inputCell.set({disabled:'disabled'});

    This work fine.

    0 讨论(0)
提交回复
热议问题