`
tayuexiaotian
  • 浏览: 24471 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

ExtJS-窗体内组件访问

EXT 
阅读更多

Ext.onReady(function() {

 

var _window = new Ext.Window({

title : "测试窗体",

layout : "form",

width : 300,

plain : true,

items : [{

xtype : "textfield",

id:"name",

fieldLabel : "姓名"

},{

xtype : "textfield",

id:"password",

fieldLabel : "密码"

}],

buttons : [{

text : "确定",

handler : function() {

var coll=this.ownerCt.items;//读到当前窗体中的items

var temp="";

temp+="姓名是:"+coll.first().getValue();

temp+="密码是:"+coll.itemAt(1).getValue();

alert(Ext.getCmp("name").getValue()+Ext.getCmp("password").getValue());//通过id得到items

Ext.MessageBox.alert("提示信息",temp);

}

}]

});

_window.show();

});

 

这个例子中ownerCt返回的是button的当前容器_window,然后通过容器_window访问自组件items中的内容

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics