Ext.form.FormPanel对象的学习布局

UserPhoneTestWin = Ext.extend(Ext.Window, {
	constructor : function() {
		var tmId = "";
		//copy 参数属性到当前对象
		var cfg = cfg || {};
		this.initCom();
		UserPhoneTestWin.superclass.constructor.call(this, {
			title:'按用户号码',
			id:'_userTest',
			width:500,
			height:180,
			frame :true,
			border:false
		}); 
	},
	initCom:function(){
		 var form = new FormPanel();
		 this.items=[form];
	}
});


FormPanel = new  Ext.extend(Ext.form.FormPanel,{
	constructor : function() {
		var tmId = "";
		//copy 参数属性到当前对象
		var cfg = cfg || {};
		this.initCom();
		UserPhoneTestWin.superclass.constructor.call(this, {
			width:490,
			height:150,
			frame :true,
			border:false,
			items: [{
				xtype: 'panel',
				layout: 'column',
				style: 'margin: 20px 0 0 10px;',
				items: [
				        {
				        	columnWidth: .8,
				        	layout: 'form',
				        	labelWidth: 60,
				        	labelAlign:"right",
				        	style: 'margin: 6px 0 0 30px;',
				        	items: this.userphoneText
				        },{
				        	columnWidth: .8,
				        	layout: 'form',
				        	style: 'margin: 5px 0 0 110px;',
				        	items: this.info
				        },{
				        	columnWidth: .8,
				        	layout: 'form',
				        	style: 'margin: 5px 0 0 110px;',
				        	items: this.showInfo
				        }
				]
			}],
			buttonAlign:'center',
			buttons:[{text:'测试',id:'save',iconCls:'save',handler:this.doTest,scope:this},
				     {text:'重置',iconCls:'delete',handler:this.doCancel,scope:this},
				     {text:'关闭',iconCls:'close',handler:this.doClose,scope:this}]
			
		}); 
	},
	
	initCom:function(){
		this.userphoneText = new Ext.form.TextField({
			allowBlank : false,
			width : 240,
			id : '_userphone',
			fieldLabel : '用户号',
			regex: /(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{7,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/,
			regexText: '请输入正确的用户号码格式',
			listeners: {
	        	'focus': {fn: this.promptInfo, scope: this}
	        }
		});
		
		this.info = new  Ext.form.Label({
			id:'_info',
			text: '请输入电话号码或宽带账号',
			hidden: true,
			style: 'font-size:13px;color:red;'
		});
		
		this.showInfo = new  Ext.form.Label({
			id:'_showInfo',
			text: '该账号不存在,请重新输入',
			hidden: true,
			style: 'font-size:13px;color:red;'
		});
	},
	promptInfo:function(){
		this.info.hide();
		this.showInfo.hide();
	},
	doTest:function(){
		var phoneNumber = Ext.getCmp('_userphone').getValue();
		if(phoneNumber == null || phoneNumber==""){
			Ext.getCmp('_info').show();
			Ext.getCmp('_showInfo').hide();
		}else{
			Ext.getCmp('_info').hide();
			QueryTestResultManager.saveOdnNumberTestTask(phoneNumber,function(data){
				if(data == ""){
					Ext.getCmp('_showInfo').show();
				}else if(data != null && data != ""){
					tmId = data;
					var fulls = "left=0,top=0,location=yes,resizable=yes";    //定义弹出窗口的参数
					if (window.screen) {
						var ah = screen.availHeight - 30;
						var aw = screen.availWidth - 10;
						fulls += ",height=" + ah;
						fulls += ",width=" + aw;
					}
//					
				}
			},this);
		}
	},
	doCancel:function(){
		Ext.getCmp('_userphone').reset();
	},
	doClose:function(){
		Ext.getCmp('_userTest').close();
	}
});
	


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值