1. #1
    Touch Premium Member
    Join Date
    Aug 2010
    Location
    New York, NY
    Posts
    66
    Answers
    2
    Vote Rating
    0
    sandeep45 is on a distinguished road

      0  

    Default Answered: How to override a method when defining an object by using its xtype/alias

    Answered: How to override a method when defining an object by using its xtype/alias


    Hi,

    I am defining a writer object like this:

    Code:
    writer:{
      type: 'json'
      rootProperty: 'resources'
      getRecordData: function(rec){
        alert("i was here");
        return rec.data;
      }
    }
    In this code getRecordData is never run and my alert is never fired.

    Now i have also learned that having my own class which extende the Ext.data.reader.Json and then using its alias in my code would work. All i do then is define
    getRecordData
    outside the config object in my class.

    So my question is how to define my own methods when i am instantiating an object in the style I have given above?

    Thanks

  2. When specifying any config to create an instance with, you should not define a method as it will not get overridden. If you need to override a method, you should then extend the class and override it that way.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3356
    Vote Rating
    751
    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

      1  

    Default


    When specifying any config to create an instance with, you should not define a method as it will not get overridden. If you need to override a method, you should then extend the class and override it that way.
    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.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar