View Full Version : ExtJs Button - onBlur event

28 Apr 2011, 1:43 AM

I want to run a code-block when the Button loses focus. Is there any onBlur event defined for ExtJs Button. I have checked the documentation, but didn't find any onBlur event.

Does that really exists or is there any workaround to implement the same?


28 Apr 2011, 2:17 AM
check mouseout

28 Apr 2011, 4:22 AM
You need to be looking at the events of the underlying btnEl (http://dev.sencha.com/deploy/ext-3.3.1/docs/?class=Ext.Button&member=btnEl). For example, in \examples\form\dynamic.js, give the 'Save' button an id ('save-simple') and the following will work for you:

Ext.getCmp('save-simple').btnEl.on('blur', function()
// whatever you need to do

28 Apr 2011, 11:12 AM
check mouseout

This method wont work. Because, the mouseout event will fire, whenever we move the mouse out of the Button, irrespective of whether we've selected the button or not. In fact, Blur is a kind of event which fires, whenever the element (Button) loses its focus. That means, the focus have been shifted to any other element.


29 Apr 2011, 1:02 AM
Hello fay,
That's a nice trick.
It worked :)