PDA

View Full Version : [UNKNOWN][3.??] Looks like getActionEl() should be in Field.onFocus and onBlur



xor
31 Jul 2009, 7:17 AM
Field.js:

onFocus : function(){
if(this.focusClass){
this.el.addClass(this.focusClass);
}
if(!this.hasFocus){
this.hasFocus = true;
this.startValue = this.getValue();
this.fireEvent("focus", this);
}
},

Here this.el receives new class. But in base Component class there is getActionEl() method that returns element that should receive classes and so on. Maybe it should be used here also?

The same is in onBlur.

mjlecomte
31 Jul 2009, 8:17 AM
Looks to me like Component::getActionEl() is used to identify which item the Ext.Component method works on for these component methods:

onDisable
onEnable
getVisibilityEl


Ext.Component won't know which subclass is using those Component methods, for example if CheckBox is using onDisable.

On the other hand Ext.Field is implementing it's own onFocus or onBlur method so it knows to act on "this.el" already (a subclass of Field wouldn't call onFocus or onBlur and expect to operate on a different item).

xor
31 Jul 2009, 8:26 AM
On the other hand Ext.Field is implementing it's own onFocus or onBlur method so it knows to act on "this.el" already (a subclass of Field wouldn't call onFocus or onBlur and expect to operate on a different item).

I'm upgrading Ext.ux.TinyMCE now and in my case this.el points to hidden textarea, so adding classes to it won't help. getActionEl() returns wrapper element, so if onFocus will add class to it, it will be at least somehow useful.