extjs 二级下拉

新做的extjs二级下拉,兼容谷歌、火狐、iE浏览器。extjs官方文档里建议使用create而不使用new等关键字

extjs的var me = this;用的真的是到了极致。下面便有var me = this;的应用


Ext.define('Module.YB.XXXX.view.XXXXForm', {
	extend : 'Ext.form.Panel',
	labelWidth: 60,
	frame: true,
	width: 500,
	defaults: {
		labelAlign: 'right',
		width: 400
	},
	templateTypeData:function(templateTypeData){
		var me = this;
	},
	initComponent : function() {
		var me = this;
		var comStore = [];
		var tempData = me.templateTypeData; 
		$.each(tempData.dictItems,function(key,value){
			comStore.push("['"+value.value+"'","'"+value.name+"']");
		});
		var typeNumStore = 	new Ext.data.SimpleStore({  //这里最好使用create
				   fields:['name', 'name'],
		           proxy:{
		               type: 'rest',
					   headers : {
				        	"Content-Type": "application/json; charset=utf-8", 
				        	Accept : 'application/json'
				        },
		               reader: {
		                   type: 'json',
		                   successProperty:'success',
		                   root: 'datas'
		               }
		           }
		         });
		me.items = [{
					name : 'templateFile',
					xtype : 'filefield',
					fieldLabel : TEMPLATE_PROPERTY.fileName,
					regex : /.+(.zip)$/,
					emptyText: TEMPLATE_PROPERTY.uploadFileType,
					regexText : TEMPLATE_PROPERTY.uploadFileType,
					buttonText : TEMPLATE_PROPERTY.fileButton,
					msgTarget : "side",
					submitValue : true,
					allowBlank : false
				},{
		        	xtype:"combo",
		        	editable:false,
		        	queryMode: 'local', 
		 	        store:new Ext.data.SimpleStore({  
				          fields : ['key', 'value'],  
				          data :  eval('['+comStore+']')
		                  }),
		        	valueField: 'key',
		        	displayField: 'value',
		            fieldLabel : TEMPLATE_PROPERTY.type,
		            name : 'type',
		            emptyText: TEMPLATE_PROPERTY.type,
		            maxLength:50,
		            allowBlank : false,
		            listeners:{    
				            select : function(combo, record,index){  
				            	typeNumStore.proxy.url='/template/name/'+combo.value; //给已经定义好的store的url赋值
				                typeNumStore.load();   
				            }  
				        } 
		        },{
		        	xtype:"combo",
		        	editable:false,
		        	queryMode: 'local', 
		 	        store:typeNumStore,
		        	valueField: 'name',
		        	displayField: 'name',
		            fieldLabel : TEMPLATE_PROPERTY.name,
		            name : 'name',
		            emptyText: TEMPLATE_PROPERTY.name,
		            maxLength:50,
		            allowBlank : false
		        }];
		me.callParent();
	}
});


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值