PDA

View Full Version : about button add event



17 Mar 2011, 12:51 AM
my current code:
var _btn=new Ext.Button({
text:'please click me',
ui:'normal',
draggable:true,
width:300
});

_btn.on("click",function(){
alert("sencha button demo");
});

_btn.render('dvcontent');

the button display on page
but click it have not display alert dialog

if the code rewrite to follow:
var _btn=new Ext.Button({
text:'please click me',
ui:'normal',
draggable:true,
width:300,
handler:function(){alert('sencha')}
});

__btn.render('dvcontent');

that's run and have display alert dialog.

i want to know reason!
please tell me! tks