ExtJS学习笔记六:按钮获取window中的文本域

Ext.onReady(function(){
		var _window = new Ext.Window({
			title:"测试窗体",
			layout:"form",
			width:260,
			labelWidth:45,
			plain:true,
			//容器生成文本框
			items:[{
				xtype:"textfield",
				width:180,
				fieldLabel:"姓名"
			},{
				xtype:"textfield",
				width:180,
				fieldLabel:"密码"
			}],
			buttons:[{
				text:"确定",
				//句柄函数的this是指向button
				handler:function(){
					//ownerCt当前容器对象
					//容器对象的集合,
					var collection = this.ownerCt.items;
					//first(),就是这个文本框
					alert(collection.first().getValue());
					alert(collection.itemAt(1).getValue());
				}
			}]
		});
		_window.show();
	})

你可能感兴趣的:(function,测试,layout,ExtJs)