1. #1
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
    Webtel is on a distinguished road

      0  

    Exclamation 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'}
    });

  2. Ext.Loader is a singleton (just an JS object), so it can not be overriden like prototype based classes.

    you can go for:
    Code:
    Ext.Loader.loadScriptFile = function(){...};
    or use Ext.apply() instead.

  3. #2
    Sencha - Services Team tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,305
    Vote Rating
    7
    Answers
    58
    tobiu will become famous soon enough

      0  

    Default


    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;
            ...
    Best regards
    Tobias Uhlig
    __________


    Sencha Inc
    Tobias Uhlig, Solutions Engineer

    Private Projects:

    S-CIRCLES Social Network Engine
    Commercial Theming for Ext JS 3 & 4

  4. #3
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
    Webtel is on a distinguished road

      0  

    Default


    much thanks, but im facing problem with Ext.Loader override

    Code:
    cls.prototype is undefined
          override: function(cls, overrides) {
                     if (cls.prototype.$className) {
    i written something like this.. is it heading right direction? or how it should be done?

    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;

  5. #4
    Sencha - Services Team tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,305
    Vote Rating
    7
    Answers
    58
    tobiu will become famous soon enough

      0  

    Default


    Ext.Loader is a singleton (just an JS object), so it can not be overriden like prototype based classes.

    you can go for:
    Code:
    Ext.Loader.loadScriptFile = function(){...};
    or use Ext.apply() instead.
    Best regards
    Tobias Uhlig
    __________


    Sencha Inc
    Tobias Uhlig, Solutions Engineer

    Private Projects:

    S-CIRCLES Social Network Engine
    Commercial Theming for Ext JS 3 & 4

  6. #5
    Sencha - Services Team tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,305
    Vote Rating
    7
    Answers
    58
    tobiu will become famous soon enough

      0  

    Default


    feel free to open a feature request fo this topic btw. -> feature request forum.
    Best regards
    Tobias Uhlig
    __________


    Sencha Inc
    Tobias Uhlig, Solutions Engineer

    Private Projects:

    S-CIRCLES Social Network Engine
    Commercial Theming for Ext JS 3 & 4

  7. #6
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
    Webtel is on a distinguished road

      0  

    Default


    great thanks. now it works like a bliss. I will start thread in feature request forum also. Cheers!