当前位置: 代码迷 >> Web前端 >> 带复选框且支持搜索功能的上拉列表4
  详细解决方案

带复选框且支持搜索功能的上拉列表4

热度:82   发布时间:2012-10-07 17:28:51.0
带复选框且支持搜索功能的下拉列表4
// private
    initEvents : function()
    {
        Ext.form.ComboBox.superclass.initEvents.call(this);

        this.keyNav = new Ext.KeyNav(this.el, {
            "up" : function(e)
            {
                this.inKeyMode = true;
                this.selectPrev();
            },

            "down" : function(e)
            {
                if (!this.isExpanded())
                {
                    this.onTriggerClick();
                }
                else
                {
                    this.inKeyMode = true;
                    this.selectNext();
                }
            },

            "enter" : function(e)
            {
                this.onViewClick();
                //return true;
            },

            "esc" : function(e)
            {
                this.collapse();
            },

            "tab" : function(e)
            {
                this.onViewClick(false);
                return true;
            },

            scope : this,

            doRelay : function(foo, bar, hname)
            {
                if (hname == 'down' || this.scope.isExpanded())
                {
                    return Ext.KeyNav.prototype.doRelay.apply(this, arguments);
                }
                return true;
            },

            forceKeyDown : true
        });
        this.queryDelay = Math.max(this.queryDelay || 10, this.mode == 'local' ? 10 : 250);
        this.dqTask = new Ext.util.DelayedTask(this.initQuery, this);
        if (this.typeAhead)
        {
            this.taTask = new Ext.util.DelayedTask(this.onTypeAhead, this);
        }
        if (this.editable !== false)
        {
            this.el.on("keyup", this.onKeyUp, this);
        }
        if (this.forceSelection)
        {
            this.on('blur', this.doForce, this);
        }
    },

    onDestroy : function()
    {
        if (this.view)
        {
            this.view.el.removeAllListeners();
            this.view.el.remove();
            this.view.purgeListeners();
        }
        if (this.list)
        {
            this.list.destroy();
        }
        this.bindStore(null);
        Ext.form.ComboBox.superclass.onDestroy.call(this);
    },
  相关解决方案