PDA

View Full Version : MouseDown event handler on Button



Kamysh
21 Jan 2011, 10:44 AM
Hi everyone

How should I attach "mousedown" event handler to Ext.Button ?

The approach below does not work:


new Ext.Button({
text: ">",
width: 20,
renderTo: "RightDiv",
listeners: {
render: function(b) {
this.mon(this, "mousedown", function() { alert("mousedown") });
}
}
});
Thanks in advance

valititi
21 Jan 2011, 8:56 PM
listeners:{
'render':
function(c){
c.getEl().on('mousedown',
function(){
alert("something");
// first try it simple, then make it more complicated here...
},
c);
}
}
I not tested... Hope this can works...

Condor
22 Jan 2011, 8:34 AM
Or if you prefer using mon (which IMHO you should):

this.mon(this.getEl(), "mousedown", function() { alert("mousedown") });
('el' is the button <table> element - you could also use 'btnEl', the actual <button> element)