Created
December 28, 2011 14:22
-
-
Save dmackerman/1528101 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Override | |
Ext.override(Ext.Button, { | |
preventFocus : false, | |
// @override | |
onMouseDown : function(e){ | |
if(!this.disabled && e.button === 0){ | |
if (this.preventFocus) { // injected line here | |
e.stopEvent(); | |
} | |
this.getClickEl(e).addClass('x-btn-click'); | |
this.doc.on('mouseup', this.onMouseUp, this); | |
} | |
}, | |
// @override | |
onMouseUp : function(e){ | |
if(e.button === 0){ | |
if (this.preventFocus) { // injected line here | |
e.stopEvent(); | |
} | |
this.getClickEl(e, true).removeClass('x-btn-click'); | |
this.doc.un('mouseup', this.onMouseUp, this); | |
} | |
} | |
}); | |
//Usage | |
new Ext.Button({ | |
preventFocus : true, | |
text : 'I do not focus on click!' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment