-
14 Mar 2012 7:43 AM #1
[4.1b3] Trigger field blur events don't pass event objects
[4.1b3] Trigger field blur events don't pass event objects
REQUIRED INFORMATION
Ext version tested:- Ext 4.1b3
- Ext 4.1b2
- Ext 4.1b1
Browser versions tested against:- FF 10 (firebug 1.91)
- IE8
- Chrome 16
Description:- The 'blur' event for TriggerField components does not supply an event object to its listeners, even though the documentation indicates that it should. (Note: I'm referring to the 4.1 docs bundled with the beta release, not the out-of-date 4.0 documentation online.)
Steps to reproduce the problem:- Create a TriggerField with a listener for the 'blur' event.
- Attempt to use the event object parameter given to the listener function.
The result that was expected:- The event object should be passed to the listener.
The result that occurs instead:- The event object is undefined.
Test Case:
HELPFUL INFORMATIONCode:Ext.onReady(function() { Ext.create('Ext.form.field.Trigger', { renderTo: Ext.getBody(), listeners: { focus: function(cmp, event) { console.log(event); // prints an appropriate event object }, blur: function(cmp, event) { console.log(event); // prints undefined } } }); });
Debugging already done:- This appears to be an issue in the source for the trigger field's mimicBlur and triggerBlur methods:
Code:// private mimicBlur: function(e) { if (!this.isDestroyed && !this.bodyEl.contains(e.target) && this.validateBlur(e)) { this.triggerBlur(); // the event object 'e' is not passed to the triggerBlur method } }, // private triggerBlur: function() { var me = this; me.mimicing = false; me.mun(me.doc, 'mousedown', me.mimicBlur, me); if (me.monitorTab && me.inputEl) { me.un('specialkey', me.checkTab, me); } Ext.form.field.Trigger.superclass.onBlur.call(me); // no event object is passed to the superclass if (me.bodyEl) { me.bodyEl.removeCls(me.wrapFocusCls); } },
Possible fix:- Starting on line 379 of Trigger.js, modify the mimicBlur and triggerBlur methods to pass the event object:
Code:mimicBlur: function(e) { if (!this.isDestroyed && !this.bodyEl.contains(e.target) && this.validateBlur(e)) { this.triggerBlur(e); } }, triggerBlur: function(e) { var me = this; me.mimicing = false; me.mun(me.doc, 'mousedown', me.mimicBlur, me); if (me.monitorTab && me.inputEl) { me.un('specialkey', me.checkTab, me); } Ext.form.field.Trigger.superclass.onBlur.call(me, e); if (me.bodyEl) { me.bodyEl.removeCls(me.wrapFocusCls); } }
Additional CSS used:- only default ext-all.css
Operating System:- Win7
-
15 Mar 2012 6:40 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
Thanks for the report.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
You found a bug! We've classified it as
EXTJSIV-5620
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote