-
24 Nov 2011 11:37 PM #1
Answered: Ext.Loader extra param?
Answered: Ext.Loader extra param?
I need to add extra param to required scripts - decache purpose, but version based (i want to switch version number to have possibility of decacheing production and yet still caching it)
Can anybdy provide Ext.Loader override to have that posiibility. I imagine it to work like:
Code:Ext.Loader.setConfig({ enabled: true, disableCaching: false, extraParams:{ _v:1.0 }, paths: { 'TS.lib' : '/library'} });
-
Best Answer Posted by tobiu
Ext.Loader is a singleton (just an JS object), so it can not be overriden like prototype based classes.
you can go for:
or use Ext.apply() instead.Code:Ext.Loader.loadScriptFile = function(){...};
-
25 Nov 2011 1:36 AM #2Sencha - Services Team
- Join Date
- May 2007
- Location
- Munich (Germany)
- Posts
- 2,305
- Vote Rating
- 7
- Answers
- 58
i don't think this is possible yet.
you can take a look at:
http://docs.sencha.com/ext-js/4-0/source/Loader.html
and override the method::
Code:loadScriptFile: function(url, onLoad, onError, scope, synchronous) { var me = this, noCacheUrl = url + (this.getConfig('disableCaching') ? ('?' + this.getConfig('disableCachingParam') + '=' + Ext.Date.now()) : ''), fileName = url.split('/').pop(), isCrossOriginRestricted = false, xhr, status, onScriptError; ...
-
25 Nov 2011 3:32 AM #3
much thanks, but im facing problem with Ext.Loader override
i written something like this.. is it heading right direction? or how it should be done?Code:cls.prototype is undefined override: function(cls, overrides) { if (cls.prototype.$className) {
Code:Ext.override(Ext.Loader,{ loadScriptFile: function(url, onLoad, onError, scope, synchronous) { var params = this.getConfig('extraParams'); if(params){ if(!Ext.isString(params))params = Ext.Object.toQueryString(params); } var me = this, noCacheUrl = url + ( this.getConfig('disableCaching') ? ('?' + this.getConfig('disableCachingParam') + '=' + Ext.Date.now()) : (params ? '?'+params :'') ), fileName = url.split('/').pop(), isCrossOriginRestricted = false, xhr, status, onScriptError;
-
25 Nov 2011 3:38 AM #4Sencha - Services Team
- Join Date
- May 2007
- Location
- Munich (Germany)
- Posts
- 2,305
- Vote Rating
- 7
- Answers
- 58
Ext.Loader is a singleton (just an JS object), so it can not be overriden like prototype based classes.
you can go for:
or use Ext.apply() instead.Code:Ext.Loader.loadScriptFile = function(){...};
-
25 Nov 2011 3:40 AM #5
-
25 Nov 2011 3:59 AM #6
great thanks. now it works like a bliss. I will start thread in feature request forum also. Cheers!


Reply With Quote