PDA

View Full Version : How can I add event listener to child component?



kiryu
19 Oct 2010, 9:57 PM
/*
* File: MyViewport.js
* Date: Tue Oct 20 2009 11:11:10 GMT+0800 (Öйú±ê׼ʱ¼ä)
*
* This file was generated by Ext Designer version xds-1.0.2.14.
* http://www.extjs.com/products/designer/
*
* This file will be generated the first time you export.
*
* You should implement event handling and custom methods in this
* class.
*/


MyViewport = Ext.extend(MyViewportUi, {
initComponent: function() {
MyViewport.superclass.initComponent.call(this);
this.on({
afterlayout:{scope:this, single:true, fn:function() {

this.findById('testbutton').on({
click:{scope: this, single: true, onclick:function(){
Ext.Msg.alert("OK");
}}
});
}}
});

}
});I try the solution above, but findById() gets null.
I am new to Ext Designer, please some one tells me how.
Thanks a lot!

jarrednicholls
20 Oct 2010, 4:42 AM
Hi kiryu,

Interestingly enough, this question was just recently answered yesterday: http://www.sencha.com/forum/showthread.php?112964-Question-about-button-handler-and-other-config-options

Jarred

kiryu
21 Oct 2010, 7:11 AM
Thanks, Jarred.
I really appreciate it.