PDA

View Full Version : how to get Ext.Button.click proxy



dppware
27 Oct 2010, 5:39 AM
Hello, first of all sorry for my english poor. ;-(

In my application, before any button click event, I would to fires an "validationFunction" for each button action (handler).

To do this, i should to override Ext.Button (to get this performs for all my application buttons) and I tried this:
Ext.override(Ext.Button, {
initComponent:function() {
// call parent init component
Ext.Button.superclass.initComponent.apply(this, arguments);
// add custom events
this.addEvents('criticalAction',this.criticalAction);
//Add listener
Ext.Button.superclass.mon(this.el, 'criticalAction', this.criticalAction(), this,{buffer: 50});
//change click event to fires criticalAction
this.clickEvent = 'criticalAction';
log(Ext.Button);

},
criticalAction : function (){
alert('es una accion critica');
Ext.Button.onClick(this);

}
});

but this not work, because AddListener throws me.events = undefined

I found preventEvent() on Ext.Button.onclick but I dont know how edit it.

Thanks your help!!

dppware
27 Oct 2010, 5:49 AM
well, better do:
criticalAction: function (){
this.fireEvet('click', this);
}

what im doing wrong?

thks

plalx
27 Oct 2010, 5:52 AM
Take a look at Observable.observeClass (http://dev.sencha.com/deploy/dev/docs/?class=Ext.util.Observable&member=Observable.observeClass)

dppware
4 Nov 2010, 12:22 AM
thanks !!