Results 1 to 3 of 3

Thread: ExtJS MVC application and loading resources as needed basis

  1. #1
    Ext JS Premium Member
    Join Date
    Mar 2011
    Posts
    33

    Default ExtJS MVC application and loading resources as needed basis

    Hi,

    I'm trying to construct MVC application that would load resources only when needed. Now when I've views, stores etc. listed on an application they're loaded at startup - something I though loader would take care of.

    How I can construct my app so that only requested parts are loaded?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,388

    Default

    You need to load things up front. If you load them when you need them you will have to load lots of classes which will have bad performance. Having them compiled and minified into one file will perform better.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User mysticav's Avatar
    Join Date
    Mar 2007
    Location
    Mexico
    Posts
    531

    Default

    You can set this before running Ext.Application:

    Code:
     Ext.Loader.setConfig({enabled:true});
    Using that option, classes will be loaded on demand, as long as you setup the paths correctly. This is great for development and debugging.

    A good way to implement this autoloading approach is to use the property "views" and "stores" of your controllers. Each controller can include its own required classes and even instantiate them. On views you can use "requires".
    A controller can load a Panel. That Panel can require a Grid. And so on.

    Read the MVC Tutorials.

    Those controllers can be loaded as needed using yourapp.getController() method. "yourapp" is the instance of Ext.Application.

    Once you are ready for production deploy, you can turn off autoloading, and create a minified version using Sencha SDK.

    Forget about using auto loading on a production version, specially if it is hosted on the cloud. Your app will be terribly slow.

Posting Permissions

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