Extjs combobox: hide selected value from dropdown list

后端 未结 5 1435
青春惊慌失措
青春惊慌失措 2021-02-15 14:57

I\'m using ExtJS 4 and looking for a way I can hide currently selected value from combo\'s dropdown list?

So instead of this (\"Alaska\" currently selected in combobox):

5条回答
  •  余生分开走
    2021-02-15 15:27

    ExtJS 3 I wrote this answer based on the others. Works great for me, its a little modified from what your looking for though.

    Name.space.name = new Ext.extend(Ext.form.ComboBox, {
        type: 'all',
        oldrec: null,
        store: null,
        constructor: function (config) {
            var me = this;
            if (config.type === 'all') {
                me.store = AllConditionStore;
            } else {
                me.store = ?.?('RuleParameterType');
            }
            config = Ext.apply({
                store: me.store,
                valueField: 'id',
                hideActive: true,
                triggerAction: 'all',
                lazyRender: true,
                allowBlank: false,
                mode: 'local',
                displayField: 'text',
                listeners: {
                    select: function (me, recs, index) {
                        if (me.oldrec !== null)
                            me.store.add(me.oldrec);
                        me.oldrec = recs;
                        // remove the selected from the store
                        me.store.remove(recs);
                        // redo store
                    }
                }
            }, config);
            ?.?.Parameter.superclass.constructor.call(this, config);
        }
    });
    

提交回复
热议问题