Docs Help

Terms, Icons, and Labels

Many classes have shortcut names used when creating (instantiating) a class with a configuration object. The shortcut name is referred to as an alias (or xtype if the class extends Ext.Component). The alias/xtype is listed next to the class name of applicable classes for quick reference.

Access Levels

Framework classes or their members may be specified as private or protected. Else, the class / member is public. Public, protected, and private are access descriptors used to convey how and when the class or class member should be used.

Member Types

Member Syntax

Below is an example class member that we can disect to show the syntax of a class member (the lookupComponent method as viewed from the Ext.button.Button class in this case).

lookupComponent ( item ) : Ext.Component
protected

Called when a raw config object is added to this container either during initialization of the items config, or when new items are added), or {@link #insert inserted.

This method converts the passed object into an instanced child component.

This may be overridden in subclasses when special processing needs to be applied to child creation.

Parameters

item :  Object

The config object being added.

Returns
Ext.Component

The component to be added.

Let's look at each part of the member row:

Member Flags

The API documentation uses a number of flags to further commnicate the class member's function and intent. The label may be represented by a text label, an abbreviation, or an icon.

Class Icons

- Indicates a framework class

- A singleton framework class. *See the singleton flag for more information

- A component-type framework class (any class within the Ext JS framework that extends Ext.Component)

- Indicates that the class, member, or guide is new in the currently viewed version

Member Icons

- Indicates a class member of type config

- Indicates a class member of type property

- Indicates a class member of type method

- Indicates a class member of type event

- Indicates a class member of type theme variable

- Indicates a class member of type theme mixin

- Indicates that the class, member, or guide is new in the currently viewed version

Class Member Quick-Nav Menu

Just below the class name on an API doc page is a row of buttons corresponding to the types of members owned by the current class. Each button shows a count of members by type (this count is updated as filters are applied). Clicking the button will navigate you to that member section. Hovering over the member-type button will reveal a popup menu of all members of that type for quick navigation.

Getter and Setter Methods

Getting and setter methods that correlate to a class config option will show up in the methods section as well as in the configs section of both the API doc and the member-type menus just beneath the config they work with. The getter and setter method documentation will be found in the config row for easy reference.

History Bar

Your page history is kept in localstorage and displayed (using the available real estate) just below the top title bar. By default, the only search results shown are the pages matching the product / version you're currently viewing. You can expand what is displayed by clicking on the button on the right-hand side of the history bar and choosing the "All" radio option. This will show all recent pages in the history bar for all products / versions.

Within the history config menu you will also see a listing of your recent page visits. The results are filtered by the "Current Product / Version" and "All" radio options. Clicking on the button will clear the history bar as well as the history kept in local storage.

If "All" is selected in the history config menu the checkbox option for "Show product details in the history bar" will be enabled. When checked, the product/version for each historic page will show alongside the page name in the history bar. Hovering the cursor over the page names in the history bar will also show the product/version as a tooltip.

Search and Filters

Both API docs and guides can be searched for using the search field at the top of the page.

On API doc pages there is also a filter input field that filters the member rows using the filter string. In addition to filtering by string you can filter the class members by access level, inheritance, and read only. This is done using the checkboxes at the top of the page.

The checkbox at the bottom of the API class navigation tree filters the class list to include or exclude private classes.

Clicking on an empty search field will show your last 10 searches for quick navigation.

API Doc Class Metadata

Each API doc page (with the exception of Javascript primitives pages) has a menu view of metadata relating to that class. This metadata view will have one or more of the following:

Expanding and Collapsing Examples and Class Members

Runnable examples (Fiddles) are expanded on a page by default. You can collapse and expand example code blocks individually using the arrow on the top-left of the code block. You can also toggle the collapse state of all examples using the toggle button on the top-right of the page. The toggle-all state will be remembered between page loads.

Class members are collapsed on a page by default. You can expand and collapse members using the arrow icon on the left of the member row or globally using the expand / collapse all toggle button top-right.

Desktop -vs- Mobile View

Viewing the docs on narrower screens or browsers will result in a view optimized for a smaller form factor. The primary differences between the desktop and "mobile" view are:

Viewing the Class Source

The class source can be viewed by clicking on the class name at the top of an API doc page. The source for class members can be viewed by clicking on the "view source" link on the right-hand side of the member row.

Ext JS 5.1.4


top

Developing for Multiple Environments and Screens

Producing an application that is functional, usable, and beautiful across all devices is the holy grail of application development. Creating an application that meets all of these requirements can be accomplished in a few different ways.

Build Profiles

Build profiles allow developers to create variations of an application based on the builds object found in an application's app.json file. Historically, users have had the opportunity to differentiate builds based on theme and locale.

We talked more about app.json above, but for more information, please check out the microloader guide.

A builds config should look similar to the following JSON structure:

"builds": {

   "foo": {
      "theme"   : "theme-neptune",
      "slicer"  : null,

      "requires": [
           "ux",
           "charts"
       ]     
   },
   "bar": {
     "theme"   : "theme-classic",
     "slicer"  : null,

     "requires": [
          "charts"
     ]     
   }

}

What to Expect when you are Building

Let's talk about the outcome you would expect based on the builds object above. This builds config allows you to issue the following build commands from Sencha Cmd:

// Build foo application only
sencha app build foo

// Build bar application only
sencha app build bar 

// Build all targets within the builds object
sencha app build 

Note: Build target names can be anything you choose. You could replace foo with meow, and then issue:

sencha app build meow

The resulting foo application would have access to the ux and charts package, and display the Neptune theme.

The resulting bar application have access to the charts package, and display the Classic theme.

You can create as many variations within the builds object as you like. All output will show up in your root level builds folder by default.

Runtime Configurations

There are also several ways to use an application’s runtime environment to create applications. These methods include app profile, responsive configs, and platform configs.

Let's explore the possibilities each of them presents and how they can work together to provide your users with a seamless experience across many mediums.

App Profiles

Using Ext.app.Profile allows developers to swap out an application's view based on a defined criteria via the mainView (or Viewport). This means you can create an entirely different view for your application by activating a profile for specific conditions. For instance, you may want to present specific views depending on whether your application is being loaded on a Mobile device -vs- a Desktop browser.

In this case, you would create two profiles and then list them in your profiles array found on the Application class. Here's a simple example of such a setup:

Ext.define('App.Application', {
    extend: 'Ext.app.Application',

    profiles: [
        'Desktop',
        'Mobile'
    ]
});

The active profile is determined by the returned value of the isActive method on your profile. Here's an example of how you could configure an application to load the desktop view based on the detected OS.

Ext.define('App.profile.Desktop', {
    extend: 'Ext.app.Profile',

    mainView: 'App.view.desktop.Main',

    isActive: function () {
        return Ext.os.is.Desktop;
    },

    launch: function () {
        console.log('Launch Desktop');
    }
});

Profiles do not have to use the mainView config. Instead, you could use the profile's launch method for any further custom processing. Only the active profile’s launch method will be called.

Platform Configs

The platformConfig property can be used in class declarations or to configure object instances based on the current platform or device classification. We might use this in a view like so:

Ext.define('App.view.summary.Manufacturing', {
    extend: 'Ext.panel.Panel',

    title: 'Mfg Summary',

    platformConfig: {
        desktop: {
            title: 'Manufacturing Summary'
        }
    }
});

The above has the same result as the direct approach below:

Ext.define('App.view.summary.Manufacturing', {
    extend: 'Ext.panel.Panel',

    title: testForDesktop ? 'Manufacturing Summary'
                          : 'Mfg Summary'
});

The idea is not to compare the merits of platformConfig versus a ternary operator, but rather to see that platformConfig is treated as part of the class declaration. As such, this approach will work regardless of the base class. One reason to prefer platformConfig over inline logic is to keep a view as data-only which can be safely sent in JSON format.

One can also use platformConfig to configure instances:

Ext.define('App.view.summary.Manufacturing', {
    extend: 'Ext.panel.Panel',

    items: [{
        xtype: 'panel',

        platformConfig: {
            desktop: {
                title: 'Manufacturing Summary'
            },
            '!desktop': {
                title: 'Mfg Summary'
            }
        }
    }]
});

The best direct translation of the above would be:

Ext.define('App.view.summary.Manufacturing', {
    extend: 'Ext.panel.Panel',

    items: [
        Ext.merge({
            xtype: 'panel'
        },
        testForDesktop ? {
            title: 'Manufacturing Summary'
        } : {
            title: 'Mfg Summary'
        })
    ]
});

In this use of platformConfig, however, the merging is handled by the initConfig method. In other words, providing a platformConfig property as an instance configuration is only supported for classes that call initConfig in their constructor. This is the case for Ext.Widget, Ext.Component, most of the data package classes (such as AbstractStore), and any class that uses Observable.

Similar to how using platformConfig in a class declaration modifies the class body, using platformConfig on an instance config modifies the initial configuration of the object.

Responsive Configs

Ext JS 5.0 introduced the responsiveConfig and the Responsive Mixin and plugin that enables it. responsiveConfig's rules and properties are not only evaluated when creating instances, but when device orientation or viewport size changes. While this adds some overhead compared to platformConfig, it is likely to be more efficient than handling these yourself by listening to window resize or orientation change.

If we adjust our criteria slightly, we can make the title respond to device size instead of device classification ("desktop").

Ext.define('App.view.summary.Manufacturing', {
    extend: 'Ext.panel.Panel',
    mixins: ['Ext.mixin.Responsive'],

    responsiveConfig: {
        'width >= 600': {
            title: 'Manufacturing Summary'
        },
        'width < 600': {
            title: 'Mfg Summary'
        }
    }
});

Because the above class has a responsiveConfig, we benefit from using the mixin here and avoid creating a plugin for each instance. When used on a component instance, however, we must use the responsive plugin instead:

Ext.define('App.view.summary.Manufacturing', {
    extend: 'Ext.panel.Panel',

    items: [{
        xtype: 'panel',
        plugins: 'responsive',

        responsiveConfig: {
            'width >= 600': {
                title: 'Manufacturing Summary'
            },
            'width < 600': {
                title: 'Mfg Summary'
            }
        }
    }]
});

It is important to remember that width in the above example is viewport width, not component width.

Conclusion

With all these tools at hand, it is just a matter of picking the right tool for the particular situation. For simple tuning at load time, there is platformConfig. For more dynamic conditions, there is responsiveConfig. To change things on a larger scale, there is Ext.app.Profile.

And if you need an application that looks completely different on tablets than it does on desktop, or even phones, you could consider Sencha Cmd build profiles. Build profiles can remove the tablet overhead from the desktop build and vice versa.

Since there cannot be a "one size fits all" solution, Ext JS provides different tools that combine efficiency and flexibility. They each work together to help ensure that your application will be a natural fit for the widest possible range of devices.

Ext JS 5.1.4