아래 상자에서 여러 열 그림을 선택할 수 있습니다

프론트 데스크

Ext.ns('Ext.ux');
Ext.ux.CssShowCombo = Ext.extend(Ext.form.ComboBox ,{
	array			: [],
	selectOnFocus 	: true,
	minListWidth	: 200,
	pageSize		: 50,
	autoScroll		: true,
	lazyInit      	: true,
	typeAhead		: true,
    triggerAction	: 'all',
    lazyRender		: true,
    mode			: 'remote',
    valueField		: 'name',
    displayField	: 'name',
	initComponent 	: function(){
		Ext.ux.CssShowCombo.superclass.initComponent.call(this);
	},
    store: new Ext.data.Store({
    	url 	: contextPath+'/cssShow/getData.do',
    	reader	: new Ext.data.JsonReader({
    		root: 'root',
   	 		totalProperty: 'totalCount',
		    fields: [
		        {name: 'name'},
		        {name: 'url'}
		    ]
		})
    }),
	tpl : new Ext.XTemplate(
			'<table>',
				'<tr>',
					'<tpl for=".">',
						'<td class="x-combo-list-item" height="16px" width="16px">',
							'<img  src="{url}" />',
						'</td>',
					'<tpl if="xindex % 5 === 0">',//if="xindex % 5 === 0"
					'</tr>',
					'<tr>',
					'</tpl>',
					'</tpl>',
				'</tr>',
			'</table>'
	),
	/*onRender:function(ct,position) {
		// call parent onRender
        Ext.ux.CssShowCombo.superclass.onRender.call(this, ct, position);
 
		// adjust styles
        this.wrap.applyStyles({position:'relative'});
        this.el.addClass('ux-icon-combo-input');
 
        // add div for icon
        this.icon = Ext.DomHelper.append(this.el.up('div.x-form-field-wrap'), {
            tag: 'img', style:'position:absolute;height:16px;width:16px;left:0px;'
        });
    },
 
    setIconCls: function(value) {
      var rec = this.store.query(this.valueField, this.getValue()).itemAt(0);
        if(rec) {
			this.icon.src = rec.get('url');
        }
    },
 
    setValue: function(value) {
        Ext.ux.CssShowCombo.superclass.setValue.call(this, value);
        this.setIconCls(value);
    },*/
	listeners : {
    	'beforerender' : function(thisCmp){
    		if(this.array.length<=0){
				// css, urls url 
	    		var urls=[
					'/resources/css/silk.css'
				];
				var content = '';
				var i = 1;
	    		var silkSuccFn = function(response,opts){
					var text = response.responseText;
					content += text;
					if(i<urls.length){
						/*Gov.Ajax.request({
							url:contextPath+urls[i],
							mskCfg:{el:this.el},
							success:silkSuccFn,
							scope:this
						});*/
						Ext.Ajax.request({
							url:contextPath+urls[i],
							success:silkSuccFn,
							scope:this
						});
					}else if(i==urls.length){
						/*Gov.Ajax.request({
					    	url	: contextPath+'/cssShow/dealCssContent.do',
							mskCfg 	: {el:this.el},
							params	: {'content':content},
							success	: function(response,opts){
								var ary = response.responseText;
								var obj = Ext.decode(ary);
								var lines = obj.lines;
								for(var i=0;i < lines.length;i++){
									this.array.push(lines[i]);
								}
					    		var param = {"array" : this.array};
					    		thisCmp.getStore().baseParams = param;
							},
							scope	: this
				    	});*/
					Ext.Ajax.request({// , Gov.Ajax.request  ie 
						url	: contextPath+'/cssShow/dealCssContent.do',
						params	: {'content':content},
						success	: function(response,opts){
								var ary = response.responseText;
								var obj = Ext.decode(ary);
								var lines = obj.lines;
								for(var i=0;i < lines.length;i++){
									this.array.push(lines[i]);
								}
					    		var param = {"array" : this.array};
					    		thisCmp.getStore().baseParams = param;
							},
							scope	: this
						});
					}
					i++;
				}
	    		Gov.Ajax.request({
	    			url		: contextPath+urls[0],
	    			mskCfg 	: {el:this.el},
	    			success	: silkSuccFn,
	    			scope	: this
	    		});				
			}
    	},
    	'expand' : function(thisCmp){// 
    		this.innerList.dom.style.overflowX="auto";
    	}
    	
    }
});
Ext.reg('cssshowcombo',Ext.ux.CssShowCombo);

알아볼 수 없으면 콜미.

좋은 웹페이지 즐겨찾기