Results 1 to 7 of 7

Thread: How to load external JS into a Tab

  1. #1
    Sencha User
    Join Date
    Apr 2015
    Posts
    18
    Answers
    1

    Default How to load external JS into a Tab

    I have some JS files which I wold like to load inti my application.

    The JS files are like:

    Code:
    Ext.onReady(function() {
        var storePermissoes = Ext.getStore("security.Permissoes");     storePermissoes.reload();    var req = storePermissoes.first();    var permissaoUsuario = req.get('precebiveis'); 
        Ext.util.Format.thousandSeparator = '.';     
        Ext.util.Format.decimalSeparator = ',';
    ... more stuff
    });

    To load my HTML files I use:

    Code:
    loader: {                        
      url: 'php/' + programa,                        
      renderer: 'html',                        
      autoLoad: true,                        
      scripts: true                    
    }


    Is there anything like above to load JS files? All my files start with "Ext.onReady(function() {"

    Thanks

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Are you talking about third-party JS files? You can include them in your index.html file just after the Ext JS files.

  3. #3
    Sencha User
    Join Date
    Apr 2013
    Posts
    914
    Answers
    105

  4. #4
    Sencha User
    Join Date
    Apr 2015
    Posts
    18
    Answers
    1

    Default

    Quote Originally Posted by Gary Schlosberg View Post
    Are you talking about third-party JS files? You can include them in your index.html file just after the Ext JS files.
    Thanks for the idea, but I need to load on demand.

  5. #5
    Sencha User
    Join Date
    Apr 2015
    Posts
    18
    Answers
    1

    Default

    Thanks hakimio, but where do I put the Ext.Loader.loadScript into a new Panel, inside the code:

    newTab = mainPanel.add({ xtype: 'panel',
    closable: true,
    iconCls: record.get('iconCls'),
    title: record.get('text'),
    loader: {
    url: 'app/sistema/' + programa,
    renderer: 'component',
    autoLoad: true,
    scripts: true
    }
    });

  6. #6
    Sencha User
    Join Date
    Apr 2013
    Posts
    914
    Answers
    105

    Default

    Take a look at Sencha blog post about loading views on demand.

  7. #7
    Sencha User
    Join Date
    Apr 2015
    Posts
    18
    Answers
    1

    Default

    Thanks again. It's a very good post, but...

    My Cheques.js is:

    Ext.define('Newgemma.view.sistema.Cheques', {
    extend: 'Ext.container.Container'


    , requires: [
    //


    ]
    , alias: 'widget.Cheques'
    });
    my Menu.js code is:

    Ext.Loader.loadScript({ url: "app/view/sistema/" + record.raw.className
    });
    newTab = mainPanel.add({
    xtype: extensao[0],
    closable: true,
    iconCls: record.get('iconCls'),
    title: record.get('text')
    });
    When I try to load a new panel I have recept the following error:

    ext-dev.js:8827 Uncaught Error: [Ext.createByAlias] Cannot create an instance of unrecognized alias: widget.Cheques

    Any ideas?

Similar Threads

  1. Load external JS in SA
    By newuser7000 in forum Sencha Architect 2.x: Help & Discussions
    Replies: 2
    Last Post: 7 Jun 2012, 1:07 PM
  2. How to load external JS from another JS ?
    By Anup Rana in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 8 Nov 2010, 3:15 AM
  3. Toolbar - trying to load external url to a div
    By Hedge in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 2 Jan 2010, 1:29 AM
  4. load external function
    By tlili in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 28 Apr 2009, 4:20 AM
  5. Load external url into Window
    By bpoppa in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 28 Jul 2008, 5:09 AM

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
  •