Ext.onReady(function(){ var _window = new Ext.Window({ title:'登录', layout:'form', width:280, height:150, labelWidth:50, plain:true, defaults:{width:180}, bodyStyle:'padding:3px', items:[{ xtype:'textfield', fieldLabel:'姓名' },{ xtype:'textfield', fieldLabel:'密码', type:'password' }], buttons:[{ text:'确定', handler:function(){ alert(this.ownerCt.title); //alert(this.text);this就是公布handler的对象 } }] }); _window.show(); });
想知道为什么这样无法取得值?555
Ext.onReady(function(){
var _window = new Ext.Window({
title:'登录',
layout:'form',
width:280,
height:150,
labelWidth:50,
plain:true,
defaults:{width:180},
bodyStyle:'padding:3px',
items:[{
xtype:'textfield',
fieldLabel:'姓名'
},{
xtype:'textfield',
fieldLabel:'密码',
type:'password'
}],
buttons:[{
text:'确定',
handler:function(){
[color=red]alert(this.findParentByType("window").title); [/color] //可以这样
//alert(this.text);this就是公布handler的对象
}
}]
});
_window.show();
});