-
25 Apr 2012 10:44 PM #1
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
-
26 Apr 2012 6:12 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
26 Apr 2012 7:15 AM #3Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,653
- Vote Rating
- 14
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.
-
28 May 2012 6:28 AM #4
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
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-2836
in
2.1.


Reply With Quote