日期:2014-05-16  浏览次数:20363 次

DIRECT 新技术 Extjs扩展 Ext.ux.BaseDataComboBox
简单实现方式如下所示:(加载的时候会自动显示值 数据库存的是学历名称值 )
 managDegree : new Ext.ux.BaseDataComboBox({
					fieldLabel : "学历",
					name : "managDegree",
					storeParams:{className:'ManagerDegree',author:'',orderBy:' order by {managDegreeCode}'},
					fields : ['managDegreeCode','managDegreeName'],
					title : "(<font color=black>学历代码</font>)<font color=blue>学历名称</font>",
					tpl:'<tpl for="."><div class="x-combo-list-item">({managDegreeCode})<font color=blue>{managDegreeName}</font></div></tpl>',
					//disabled : this.readOnly,
					allowBlank : true,
					emptyText : '请选择',
					selectOnFocus:true,
					valueField:'managDegreeName',
					directFn: IORegisterChangeAction.getJsonArrayResultPagesByValues,
					listeners : {
						change : function(field, newValue, oldValue) {
							this.editStatus = "系统正在校验<" + field.fieldLabel + ">,请稍后尝试保存!";
							IORegisterChangeAction.getJsonObjectForBaseData('ManagerDegree','managDegreeName',newValue, function(result, e){
								this.editStatus = null;
								if (!Ext.isEmpty(result)) {
									if (result.success) {
										field.setValue("");
										if (!Ext.isEmpty(result.data) && result.data.length>0) {
											var c = '('+result.data[0].managDegreeCode+')'+result.data[0].managDegreeName;
											field.setValue(c);
										}
									}
								}
							}.createDelegate(this));
						}.createDelegate(this)
					}					
	    	 }),