Ext.onReady(function(){
var _window = new Ext.Window({
title:"用户登陆",
frame:true,
width:250,
height:130,
plain:true,
layout:"form",
labelWidth:45,
resizable:false,
constrain:true,
closeAction:"hide",
defaults:{xtype:"textfield",width:160},
bodyStyle:"padding:5px;",
listeners:{
"show":function(){
alert("窗口显示");
},
"hide":function(){
alert("窗口隐藏");
}
},
items:[
{fieldLabel:"账号"},
{fieldLabel:"密码"}
],
buttons:[
{text:"确定",handler:function(){
var _coll = this.ownerCt.ownerCt.items;
// alert(this.ownerCt.ownerCt.title);
alert(_coll.first().getValue() + _coll.itemAt(1).getValue());
}
},
{text:"取消",handler:function(){
_window.hide();
}
}
]
});
_window.render(Ext.getBody());
_window.show();
});
当然,也可以用Ext.getCmp()来实现,效果图: