Extjs 在中获取window中items 的值,避免使用id

var forceInWin2 = new Ext.Window({
	 			id : 'creatInWin2',
		       		title: "验证",
		       	 	width: 280,
		        	height: 130,
		        	layout: "fit",
		        	draggable: true,
		    		resizable:false,
		    		closable: false,
		  //  		modal: true,
		    		closeAction: 'close', //close 关闭  hide  隐藏 
		    		plain : true,
		    		buttonAlign : "center",
		        	items : {
		           	 	xtype: "form",
			            bodyStyle: "padding:5px 5px 0",
			           	border: false,
			            layout: "form",
			            fieldDefaults: {
			                labelWidth: 40,
			                labelAlign: "left"
			            },
		            	items : [{
			            	xtype: "textfield",
			            	fieldLabel: "卡号",
			            	name: "re_messageBeforeCardNum1",
			        //    	id: "re_messageBeforeCardNum1"
		           	},{
			            	xtype: "textfield",
			            	inputType: 'password',
			            	fieldLabel: "密码",
			            	name: "re_messageBeforePassword1",
			       //     	id : "re_messageBeforePassword1"
		            	}]
		        },
		        buttons : [{
		            	text : '确定',
		            	handler : function(){
		            	   var re_messageFuncCardNum1 = forceInWin2.items.itemAt(0).items.itemAt(0).getValue();
			           var re_messageFuncPassword1 =forceInWin2.items.itemAt(0).items.itemAt(1).getValue();
		          
		            		}
		            	},{
		            		text : '取消',
		            		handler : function(){
                                        <pre name="code" class="javascript">                                       forceInWin2.colse();

 } }] });
 

在获取密码和卡号的时候可以通过getCmp(id).getValue()获取值,但是id一旦生成将是全局的id,当再次打开window的时候会出现页面混乱

我用的是

var re_messageFuncCardNum1 = forceInWin2.items.itemAt(0).items.itemAt(0).getValue();
var re_messageFuncPassword1 =forceInWin2.items.itemAt(0).items.itemAt(1).getValue();
这样就避免设置属性id,使用属性id了


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值