How to add an empty item to ExtJS combobox?

前端 未结 6 687
慢半拍i
慢半拍i 2020-12-16 12:33

I want to add and empty item (display value is blank, item height is kept as normal) to an Ext.form.ComboBox. I refered 2 links below to configure my combobox, but it still

6条回答
  •  孤城傲影
    2020-12-16 13:08

    If the store uses inline data then store.load even won't fire. Maybe there is a better solution, but I ended up inserting store records on combobox.render:

    {
        xtype: 'combo',
        displayField: 'name',
        valueField: 'value',
        store: {
            type: 'MyInlineStore',
        },
        listeners: {
            render: function(el){
                el.getStore().insert(0, [{name: '[Any]', value: ''}]);
                el.setValue(''); //select [Any] by default
            }
        },
    }
    

提交回复
热议问题