PDA

View Full Version : [CLOSED] config listeners not working



jiancha
6 Dec 2011, 4:55 AM
Hello,

here is test code:



Ext.application({
launch : function() {
var b = Ext.create('Ext.Button',{
text : 'Btn',
id: 'btn1',
centered: true,
fullscreen: true,
renderTo : Ext.getBody(),
width: 70,
height: 70,

listeners: {
click : function() {
alert('I was clicked in listeners!');
},// not working

mouseover: function() {
alert('mouseover in listeners 2!');
}// not working either
}
});
/*
Ext.getCmp('btn1').getEl().on('mouseover', function(){
alert('I am mousseovered in on');
});//It works fine
*/
}
});


is that a bug ?

Thank you !

mitchellsimoens
6 Dec 2011, 8:43 AM
What happens when you instantiate the class and pass in the listeners there? Now the ones in the config Object will be overwritten. I would use the on method within constructor or initialize.

rdougan
6 Dec 2011, 4:00 PM
There is no such thing as 'mouseover', 'click' and other desktop events. Available element events can be found in the Kitchen Sink > Touch Events example: http://docs.sencha.com/touch/2-0/touch/examples/kitchensink/index.html