Results 1 to 6 of 6

Thread: Ext.Loader extra param?

  1. #1
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
      0  

    Exclamation 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 User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,750
    Answers
    130
    Vote Rating
    128
      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

  4. #3
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
      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 User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,750
    Answers
    130
    Vote Rating
    128
      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

  6. #5
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,750
    Answers
    130
    Vote Rating
    128
      0  

    Default

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

  7. #6
    Ext JS Premium Member
    Join Date
    Oct 2011
    Posts
    84
    Vote Rating
    0
      0  

    Default

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •