-
Ext define override
When I override a class for example the Spinnerfield I insert this
Code:
Ext.define('my.Spinner', {
Ext.define('iBone.field.Spinner', {
override: 'Ext.field.Spinner',
...
})
and I put the functions that I want override, for example applyValue, but inside this method I put
Code:
this.callParent([value])
and it go to the function applyValue of the Ext.field.Spinner and then to the applyValue of the Ext.field.Number, when I want that it go directly to the second option. Because it's supposed I'm overriding this fucntion and the same in the Ext.field.Spinner would cease to exist.
Am I doing something wrong??
Sorry for my English, thanks
-
You can call the superclass of whatever component via
Code:
applyValue : function(newValue, oldValue) {
return Ext.field.Number.superclass.applyValue.call(this, newValue, oldValue);
}
-
Thanks for the reply, I'll try it.
But it's supposed that the method callParent() do the proper function when it's called from a overwritten class or it's a bug and it would go to the superclass of the class overwritten and don't to the parent function of the overwritten class??
Thanks again.
-
You may be needing callOverridden and not callParent, callOverridden !== callParent
-
I tried it with callOverridden and callParent from getValue of a class that overrides Ext.field.Number and two functions go to the same place: getValue function of class Ext.field.Number.
I guess I'll use My.field.Number.superclass.getValue.call(this).
Thanks
-
how do you know when to use calloverridden, and callparent?