PDA

View Full Version : Pb with handler in a component



fabads
27 Jun 2010, 8:13 AM
Hello,

I'm trying to write my first component and I've a problem with a handler associated to a button. Here's an example to illustrate my problem:



test = Ext.extend(Ext.Panel,{
myHandler: function(btn) {
Ext.MessageBox.alert('Test');
},

tbar: new Ext.Toolbar({
items: [{
text: 'Test',
handler: this.myHandler
}]
})
});
There is no error but the message box does not display when I click the button.

However this code is ok:


W3h.panels.GraphNow2 = Ext.extend(Ext.Panel,{
tbar: new Ext.Toolbar({
items: [{
text: 'Test',
handler: function(btn) {
Ext.MessageBox.alert('Test');
}
}]
})
});

What's wrong in the first code :-? ???

Thanks for your support.

Fabrice.