1. #1
    Sencha User
    Join Date
    Apr 2011
    Location
    Spain
    Posts
    77
    Vote Rating
    1
    Fanny144 is on a distinguished road

      0  

    Default Unanswered: Ext define override

    Unanswered: 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

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,547
    Vote Rating
    872
    Answers
    3566
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You can call the superclass of whatever component via

    Code:
    applyValue : function(newValue, oldValue) {
        return Ext.field.Number.superclass.applyValue.call(this, newValue, oldValue);
    }
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Location
    Spain
    Posts
    77
    Vote Rating
    1
    Fanny144 is on a distinguished road

      0  

    Default


    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.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,547
    Vote Rating
    872
    Answers
    3566
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You may be needing callOverridden and not callParent, callOverridden !== callParent
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Apr 2011
    Location
    Spain
    Posts
    77
    Vote Rating
    1
    Fanny144 is on a distinguished road

      0  

    Default


    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

  6. #6
    Ext JS Premium Member smokeman's Avatar
    Join Date
    Jul 2007
    Posts
    475
    Vote Rating
    2
    Answers
    4
    smokeman is on a distinguished road

      0  

    Default


    how do you know when to use calloverridden, and callparent?