O'Reilly logo

Ext JS 4 Web Application Development Cookbook by Stuart Ashworth, Andrew Duncan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dynamically loading Ext JS classes

Ext JS 4 gives us the ability to only load the parts of the framework we need, as and when we need them. In this recipe, we will explore how to use the framework to automatically load all our class dependencies on the fly.

How to do it...

We are going to use the Vehicle and Plane classes that we created in the Using inheritance recipe earlier to demonstrate dynamic loading.

  1. Configure the Ext.Loader class to enable it and map our namespaces to a physical path. This should be added before your Ext.onReady call:
    Ext.Loader.setConfig({
        enabled: true,
        paths: {
            'Cookbook': 'src/Cookbook'
        }
    });
  2. Create individual files in the src/Cookbook folder for the Vehicle and Plane classes, naming each the same as the class name (excluding ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required