Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-2836 in a recent build.
  1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    25
    Vote Rating
    0
    grnadav is on a distinguished road

      0  

    Default Ext.define's override config throwing error

    Ext.define's override config throwing error


    Using Sencha Touch 2.0.0 I am trying to override a class's behaviour.
    I am following these docs and this forum post on the subject
    But with the following code:

    Ext.define('MP.service.Override', {
    override: 'Ext.Ajax',
    request: function(cfg) {
    console.log('overriden');
    this.callOverridden(arguments);
    }
    });
    I get this error in the console:

    Uncaught TypeError: Object [object Object] has no method 'override'
    Any help would be much appreciated

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    898
    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


    Ext.Ajax is a singleton and Ext.define will not be able to override it. I'm going to open a bug to see if Ext.define will be allowed to override a singleton.
    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 Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    18
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    You should be able to override Ext.data.Connection which this derives from, or directly modify the Ext.Ajax instance. Overriding a singleton with a define seems a bit over engineered.

    Sencha Inc

    Jamie Avins

    @jamieavins

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Duluth, MN
    Posts
    128
    Vote Rating
    16
    badgerb1 will become famous soon enough

      0  

    Default


    Hi guys,

    Just like to ping the singleton override pattern here again.

    I think you guys have come up with a GREAT way to increase functionality in the main framework, or to patch it between releases by allowing for overrides. I use them quite a bit to add or fix functionality on items that are instantiated within the framework but used outside.

    I think it's pretty important especially for the patching mechanism that singletons are able to be overriden as well.

    Thanks
    Bob