extjsform 회차 제출

1474 단어 ExtJs
/**
 *  
 */
Ext.define("Ext.ux.form.Panel",{
	extend:"Ext.form.Panel",
	isValid:function(){
		var isValid = true;
		Ext.Array.each(this.items.items,function(item,index){
			if(!item.isValid()){
				isValid = false;
				item.focus();
				return false;
			}
		});	
		return isValid;
	},
	initComponent:function(){
		var me = this;
		var specialKey = function(field,e,eOpts){
			if (e.getKey() == Ext.EventObject.ENTER) {
				var isValid = true;
				if(!field.isValid()){
					field.focus();
				}else{
					if(me.isValid()) {
						 me.getForm().updateRecord();
					 }
				}
			};
			if(field.old_specialKey){
				field.old_specialKey(field,e,eOpts);
			}
		};
		Ext.Array.each(me.items,function(item,index){
			if(!Ext.isDefined(item.enterChange) || item.enterChange){
				if(item.listeners){
					if(!item.listeners.specialKey){
						item.listeners.specialKey = specialKey;
					}else{
						item.old_specialKey = item.listeners.specialKey;
						item.listeners.specialKey = specialKey;
					}
				}else{
					item.listeners = {specialKey:specialKey};
				}	
			}
		});
		me.callParent(arguments);
	}
});

 
 
만약 어떤 요소가 리턴을 제공하지 않으려면, enterChange:false를 설정합니다

좋은 웹페이지 즐겨찾기