체크 상자가 있고 검색 기능을 지원하는 드롭다운 목록 3

4601 단어 htmlext

initList : function()
    {
        if (!this.list)
        {
            var cls = 'x-combo-list';

            this.list = new Ext.Layer({
                shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false
            });

            var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);
            this.list.setWidth(lw);
            this.list.swallowEvent('mousewheel');
            this.assetHeight = 0;

            if (this.title)
            {
                this.header = this.list.createChild({cls:cls + '-hd', html: this.title});
                this.assetHeight += this.header.getHeight();
            }

            this.innerList = this.list.createChild({cls:cls + '-inner'});
            this.innerList.on('mouseover', this.onViewOver, this);
            this.innerList.on('mousemove', this.onViewMove, this);
            this.innerList.setWidth(lw - this.list.getFrameWidth('lr'))

            if (this.pageSize)
            {
                this.footer = this.list.createChild({cls:cls + '-ft'});
                this.pageTb = new Ext.PagingToolbar({
                    store:this.store,
                    pageSize: this.pageSize,
                    renderTo:this.footer
                });
                this.assetHeight += this.footer.getHeight();
            }

            if (!this.tpl)
            {
                //alert(cls);
                //x-combo-list-item
                this.tpl = '<tpl for="."><div class="' + cls + '-item"><span class="unchecked" id="checkBox_{' + this
                        .displayField + '}"+ width="20">&nbsp;&nbsp;&nbsp;&nbsp;</span>{' + this.displayField
                        + '}</div></tpl>';
            }
            this.view = new Ext.DataView({
                applyTo: this.innerList,
                tpl: this.tpl,
                singleSelect: true,
                selectedClass: this.selectedClass,
                itemSelector: this.itemSelector || '.' + cls + '-item'
            });

            this.view.on('click', this.onViewClick, this);

            this.bindStore(this.store, true);

            if (this.resizable)
            {
                this.resizer = new Ext.Resizable(this.list, {
                    pinned:true, handles:'se'
                });
                this.resizer.on('resize', function(r, w, h)
                {
                    this.maxHeight = h - this.handleHeight - this.list.getFrameWidth('tb') - this.assetHeight;
                    this.listWidth = w;
                    this.innerList.setWidth(w - this.list.getFrameWidth('lr'));
                    this.restrictHeight();
                }, this);
                this[this.pageSize ? 'footer' : 'innerList'].setStyle('margin-bottom', this.handleHeight + 'px');
            }
        }
    },

    bindStore : function(store, initial)
    {
        if (this.store && !initial)
        {
            this.store.un('beforeload', this.onBeforeLoad, this);
            this.store.un('load', this.onLoad, this);
            this.store.un('loadexception', this.collapse, this);
            if (!store)
            {
                this.store = null;
                if (this.view)
                {
                    this.view.setStore(null);
                }
            }
        }
        if (store)
        {
            this.store = Ext.StoreMgr.lookup(store);

            this.store.on('beforeload', this.onBeforeLoad, this);
            this.store.on('load', this.onLoad, this);
            this.store.on('loadexception', this.collapse, this);

            if (this.view)
            {
                this.view.setStore(store);
            }
        }
    },

좋은 웹페이지 즐겨찾기