Hybrid View

  1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    7
    Vote Rating
    0
    derrick5335 is on a distinguished road

      0  

    Red face how to use ext.loader.setpath to include a .htm file

    how to use ext.loader.setpath to include a .htm file


    Hello,

    Because I used a servelet to map all the js file to htm file so when I want use Ext.loader.setpath() and a require method after, it will include just the .js file but not the .htm file.

    What can I do?
    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,118
    Vote Rating
    453
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    If you change this, all the ExtJS files that it tries to include will be changed.

    Believe this should work but is untested:

    Code:
    Ext.override(Ext.Loader, {
    	getPath: function(className) {
    		var path = '',
    			paths = this.config.paths,
    			prefix, deepestPrefix = '';
    
    		if (paths.hasOwnProperty(className)) {
    			return paths[className];
    		}
    
    		for (prefix in paths) {
    			if (paths.hasOwnProperty(prefix) && prefix === className.substring(0, prefix.length)) {
    				if (prefix.length > deepestPrefix.length) {
    					deepestPrefix = prefix;
    				}
    			}
    		}
    
    		path += paths[deepestPrefix];
    		className = className.substring(deepestPrefix.length + 1);
    
    		path = path + "/" + className.replace(/\./g, "/") + '.htm';
    		path = path.replace(/\/\.\//g, '/');
    
    		return path;
    	}
    });
    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.

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    7
    Vote Rating
    0
    derrick5335 is on a distinguished road

      0  

    Default


    Thx for your reply but it seems that the override doesn't work, it doesn't go into the override function.

  4. #4
    Sencha User
    Join Date
    Feb 2011
    Posts
    3
    Vote Rating
    0
    havacci is on a distinguished road

      0  

    Default


    it looks like the override doesn't works... I think the code is good but it can't override the function, i don't know why..

Similar Threads

  1. Replies: 2
    Last Post: 27 Jan 2010, 8:57 AM
  2. include an other html- file
    By Generic1 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 28 Jul 2009, 6:43 AM
  3. include .php file to a panel
    By cabster in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 18 Feb 2008, 9:54 AM
  4. Include two .js files into a js file
    By Tina G in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 19 Sep 2007, 11:11 PM
  5. Include external js file
    By Digital God in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 5 Jul 2007, 7:50 AM