Sencha Inc. | HTML5 Apps

Blog

What’s New in Ext JS 5.0.1

August 07, 2014 | Don Griffin

What's New in Ext JS 5.0.1Today, we are excited to announce the general availability of Ext JS 5.0.1! This maintenance release includes a number of improvements based on feedback from the Sencha community.

Lets take a tour of the changes.

Accessibility

With Ext JS 4.2.2, we released the “ext-aria” package to provide improved support for accessibility (as described in the WAI-ARIA 1.0 standard). While this was an important step to providing tools for you to make your applications accessible, we also learned a lot from the feedback we received both from our testing partners and early adopters.

With Ext JS 5, we wanted to incorporate that feedback and provide a better solution. I am delighted to say that with Ext JS 5.0.1, support for accessibility is much improved. In large part, this is because our support for focus and keyboard navigation has moved from “ext-aria” to the framework itself.

Focus

In Ext JS 5.0.1, we have greatly improved the internal handling of focus to better align with accessibility standards. The core components (such as buttons, tabs, form fields and grids) now all provide a clear, visual indication of focus. This is a key requirement for accessible applications. To give you control over these new visual aspects, we have added several new Sass variables and mixin parameters.

Keyboard Navigation

Previous releases of Ext JS provided the Ext.FocusManager to assist in managing focus. While this class remains, it is no longer the recommended approach. Instead, all components now have a “focusable” property that is used to manage the tabIndex DOM attribute. Any component with this property that is set to true will be able to receive focus either by clicking or via the keyboard.

When these focusable components are placed in certain containers (such as toolbars), the container provides arrow key navigation and manages which item will receive the focus on entry to the container.

There is lots of information about these accessibility, focus and keyboard navigation improvements. For more details, see the Accessibility Guide

ViewModels

It has been great seeing how quickly developers have picked up ViewModels and data binding. In addition to general bug fixing, there are some noteworthy improvements related to binding.

Selection Binding

Many developers have requested that we expand on the ability to use “selection” as a bindable property on those components that support the notion (such as ComboBox, Grids, Trees, Breadcrumbs, etc).

You can now use binding to keep the selections of these components in sync. For details, see the Kitchen Sink example.

Model & Field Validation

One key improvement with form fields is that two-way bindings now check that the value is valid before updating their bound properties. To support this when binding to Model fields, the form fields can now acquire the Model’s validators and include them in their own validation.

In Ext JS 5.0.0, these validators could only be consulted by first putting back the (potentially invalid) value. With Ext JS 5.0.1, you can be assured that invalid values will never be put back into your records.

Data

Ext.data also has some important fixes and improvements with this release.

TreeStore vs Node Events

With Ext JS 5.0.0, the TreeStore class was refactored to extend Ext.data.Store. In this process, however, one key problem existed: the way a TreeStore would relay events from the root node (Ext.data.NodeInterface).

For most events fired by tree nodes, everything worked as before. Unfortunately, certain node events collided with store events which created problems for listeners. One such example is the “remove” event.

The only safe and sure fix for this issue was to prefix all node events with “node” before firing them as TreeStore events. This means that the node’s “remove” event is now fired from the TreeStore as “noderemove”. While we always strive to avoid such changes in a maintenance release, there was really no way to resolve the issue without breaking either node listeners or store listeners. We apologize for the inconvenience this change may cause.

Associations

One limitation with associations in Ext JS 5.0.0 was that if you created a new record and then dropped that record, there was no cleanup logic to handle its potential child records. This could create a situation where a session would generate, create or update operations for these child records. These operations could not be processed by the server because the parent record was not saved.

With Ext JS 5.0.1, reference fields that declare parent/child ownership between Models are consulted when dropping records. When you indicate this type of association, dropped records will automatically handle deleting their child records.

For example:

 
    Ext.define('App.model.Order', {
        extend: 'Ext.data.Model',
        // ...
    });
 
    Ext.define('App.model.OrderItem', {
        extend: 'Ext.data.Model',
 
        fields: [{
            name: 'orderId',
 
            // Indicates that the referenced Model (Order) owns these
            // records:
            reference: { parent: 'Order' }
        }]
    });
 

In this way, when an Order is dropped (marked for deletion), its child OrderItems will likewise be dropped:

 
    order.drop();
 

Further, setting parent references to null (for example, by removing it from the parent’s association store) schedules that record for cleanup.

 
   order.orderItems().removeAt(0); // removed orderItem is dropped
 
   order.orderItems().getAt(0).setOrder(null); // also drops this item
 

The server is still ultimately responsible for a full cascade delete, but the above handling ensures that the client will never reference dropped records in save operations.

Responsive Configs

The new responsiveConfig provided by Ext.mixin.Responsive and Ext.plugin.Responsive provides lots of flexibility for managing dynamic conditions cleanly.

The new responsiveFormulas allows you to add properties for responsiveConfig rules to use. For example, your main controller could do something like this to publish new properties:

 
    Ext.define('MyApp.view.main.Main', {
        extend: 'Ext.container.Container',
 
        mixins: [
            'Ext.mixin.Responsive'
        ],
 
        responsiveFormulas: {
            small: 'width < 600',
            medium: 'width >= 600 && width < 800',
            large: 'width >= 800',
 
            tuesday: function (context) {
                return (new Date()).getDay() === 2;
            }
        }
    });
 

In the above example, these new values (“small”, etc.) can be used in any of your responsiveConfigs. This can really help streamline your application’s responsiveConfigs as well as give you a single place to maintain these kinds of choices.

Charts

The “sencha-charts” package also contains several improvements, such as reusable markers like arrows, diamonds, etc. For starters, there is now a build of the sencha-charts package included in Ext JS 5.0.1 for those not using Sencha Cmd. The most significant change is that we’ve documented and exposed how to create custom chart themes.

Chart Themes

In Ext JS 5.0.0, charts shipped with several built-in themes that you could select for your charts, but building custom themes was not a documented process. With this release, we have provided this ability, so you can make your own color palettes and much more.

A theme for charts is a class derived from Ext.chart.theme.Base and given an alias that starts with “chart.theme.”. A basic theme could be as simple as this:

 
    Ext.define('App.chart.theme.Awesome', {
        extend: 'Ext.chart.theme.Base',
 
        singleton: true,
        alias: 'chart.theme.awesome',
 
        config: {
            baseColor: '#4d7fe6'
        }
    });
 

From here, you can add any number of other configs to style your series, axes and markers. To see all the options, check out the API reference for the available configs. To use the new theme we’ve created, we simply set the “theme” config on the desired charts:

 
        theme: 'awesome'
 

Sencha Cmd

Last but not least, with Sencha Cmd 5.0.1 we have expanded the options in app.json to give you much more, fine-grained control to configure things to suit your needs without having to delve into the build scripts.

output

To give you a peek at the most useful of these new controls, let’s look at the “output” object. A common requirement for some environments is to maintain the “markup” file in a folder other than where the Sencha application resides. For example:

 
    foo.php
    foo/
        app.json
        app.js
 

The difference with this model is that the markup file (“foo.php” above, but it could be anything) is in a parent folder. In previous releases, this required setting several build properties. In Sencha Cmd 5.0.1, we can now do this in app.json:

 
    {
        ...
        "indexHtmlPath": "../foo.php",
 
        "output": {
            "page": {
                "path": "../foo.php",
                "enable": false
            }
        }
    }
 

The above ensures that all paths will be calculated relative to the parent folder while also disabling the build step that rewrites the markup file. The “output” object can control many other aspects of your build’s output, from enabling compiler optimizations to tuning the microloader.

packager

Cordova and PhoneGap are now much more flexible and easier to use with the new “packager” property. This new setting allows your build to specify its packager (either “cordova” or “phonegap”) directly in app.json. Combined with the “builds” object (added in Sencha Cmd 5.0.0), we can make an app that builds for the web, iOS and Android.

For example:

 
    {
        ...
        "builds": {
            "web": {
                "default": true  // picked by "sencha app build" 
            },
            "ios": {
                "packager": "phonegap",
                "phonegap": {
                    "config": {
                        "platform": "ios",
                        "remote": true  // use PhoneGap Build
                    }
                }
            },
            "android": {
                "packager": "phonegap"
                "phonegap": {
                    "config": {
                        "platform": "android" // use Local Phonegap
                    }
                }
            }
        }
    }
 

As before, we can run a build like so:

 
    sencha app build
 

The above will use the “web” build definition. But now we can also do these builds:

 
    sencha app build ios
    sencha app build android
 

Of course, you will need to have PhoneGap installed, and you will also need to configure your PhoneGap Build credentials. Alternatively, you could remove the above “remote” config and switch to the “cordova” packager (if you have Cordova and an iOS development environment installed).

Other than formalities, you can probably see how this property cleans up your build process. Using this approach also frees you up to add “testing” to any of these builds and get uncompressed JavaScript code for debugging (something that required manual tweaks in previous releases).

Conclusion

Ext JS 5.0.1 and Sencha Cmd 5.0.1 deliver many of the most important improvements that you’ve requested. On top of all the new capabilities in Ext JS 5, we are excited to see what amazing things you can do in your apps. Download it and try it out. Then, let us know in the forums what you think.

There are 17 responses. Add yours.

Stefan

2 months ago

How can I update my current application(5.0.0) using cmd?

Martin Zeitler

2 months ago

@Stefan: sencha app upgrade

while I rather wonder, how to upgrade the whole SDK to v5.0.1.
is the any way to do this with SenchaCmd or where to get the .zip file?

Steve Rodriguez

2 months ago

Same question: How to update.

Regards

Dawesi

2 months ago

You can download 5.0.1 from the support portal if you are a subscriber.

while the package is listed under ‘ext’ on sencha command packages, I can’t seem to

Martin Zeitler

2 months ago

well, it says “general available” - so one would assume it to be available without a subscription.
updated SenchaCmd to v5.0.1 yesterday… but would like to update the SDK, as well.

Les

2 months ago

Do you have a list of bugs fixed?

Just some help

2 months ago

The GPL version is also available: sencha dot com /products/extjs/download/ext-js-5.0.1/3221

Saki

2 months ago

To upgrade:

1. change to any application directory
2. sencha app upgrade /where/you/unzipped/ext-5.0.1

Use this also if the app is part of workspace

Peter Kellner

2 months ago

Nice job on the selection row databind feature!

Martin Zeitler

2 months ago

@Dawesi clicking the hyperlink in the E-Mail does the trick smile

Tom Coulton

2 months ago

Hi, the Japanese translation of this article is here: http://www.xenophy.com/sencha-blog/11376

Artur Bodera

2 months ago

Breaking change: Ext.MessageBox is now moved to Ext.window.MessageBox

That means the following will fail:
  requires: [
      ‘Ext.MessageBox’
  ],

And has to be changed to:
  requires: [
      ‘Ext.window.MessageBox’
  ],

Don Griffin Sencha Employee

2 months ago

@All -

Commercial versions of Ext JS 5.0.1 are in the support portal. The direct links for other Ext JS 5.0.1 zips are:

http://cdn.sencha.com/ext/trial/ext-5.0.1-trial.zip
http://cdn.sencha.com/ext/gpl/ext-5.0.1-gpl.zip

Don Griffin Sencha Employee

2 months ago

@Artur -

Technically that rename was part of Ext JS 4.0.0. Ext.MessageBox is singleton instance of Ext.window.MessageBox (see http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.MessageBox). The require statement there is technically incorrect because there is no class Ext.MessageBox to require.

It would be rendered harmless, however, if something else required the right thing prior to that point which is probably what has changed. We have been working to make sure the framework does not require things into your build that are not actually needed. This fellow is a common issue for folks, as in “why do I have Ext.window.MessageBox in my build when I never use it?”.

Don Griffin Sencha Employee

2 months ago

zdm

2 months ago

Seems “Selection Binding” don’t work with multiple selection in grids and data views.

Comments are Gravatar enabled. Your email address will not be shown.

Commenting is not available in this channel entry.