Ext JS 5.0.1 is a maintenance release that addresses many bugs and limitations discovered by our community while testing Ext JS 5.0.0. We believe this update significantly strengthens the Ext JS 5 branch and we’re excited to hear your feedback. If you feel there are pieces missing from this guide, please let us know in the Ext JS 5 forums.

Let’s discuss a few of these improvements.

Accessibility

Ext JS 4.2.2 introduced 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 in creating accessible applications, we learned a lot from the feedback we received from our testing partners and early adopters. Ext JS 5.0.1 incorporates much of that feedback to provide a better solution moving forward.

Ext JS 5.0.1 re-introduces the concept of “ext-aria”, in addition to many other exciting improvements. Further, we have migrated support for focus and keyboard navigation from “ext-aria” to the framework’s core.

Focus

Ext JS 5.0.1 contains an improved strategy for the internal handling of focus. This internalization better aligns with accessibility standards. Core components, including buttons, tabs, form fields, and grids, now provide a clear, visual indication of focus. This is a key requirement for accessible applications. Users can modify several SASS variables and mixin parameters to gain more control over these new visual aspects.

Keyboard Navigation

Ext JS previously relied on Ext.FocusManager to assist in managing focus. While this class remains, it is no longer the recommended approach. It’s important to note that Ext.FocusManager has been deprecated and its future existence should not be relied upon. In its place, we have added a “focusable” property to components. This property is used to manage the tabIndex DOM attribute. Any component, with this property set to true, will be able to receive focus by clicking or via the keyboard input.

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 into the container.

For more details regarding accessibility, focus, and keyboard navigation improvements, see the Accessibility Guide.

ViewModels

We have addressed a number of bugs related to viewModels, but there are some noteworthy improvements related to binding as well.

Selection Binding

Developers may now use “selection” as a bindable property on certain components. These components include ComboBox, Grids, Trees, Breadcrumbs, etc. Using the selection binding keeps the component selections 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. The form fields can now acquire the Model’s validators and include them in their own validation.

As of Ext JS 5.0.1, invalid values will never be put back into your records.

Data

Ext.data has also been an area of a few key fixes and improvements in Ext JS 5.0.1.

TreeStore vs Node Events

The TreeStore class was refactored in Ext JS 5.0.0 to extend Ext.data.Store. With this change, TreeStore would relay events from the root node (Ext.data.NodeInterface). Unfortunately, certain node events collided with store events, which created problems for listeners. One such example was the “remove” event.

Ext JS 5.0.1 modifies the TreeStore strategy by prefixing 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”.

We always strive to avoid such changes in a maintenance release. However, this was a crucial change necessary to resolve the issue without breaking node listeners and/or store listeners.

Associations

Ext JS 5.0.0 introduced a lot of exciting new changes in terms of associations. However, one limitation that we discovered was that if you created a new record and then dropped that record, there was no cleanup logic to handle 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 since the parent record was not saved.

Ext JS 5.0.1 offers reference fields that declare parent/child ownership between Models. These reference fields are then 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 it 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 provide flexibility for cleanly managing dynamic conditions.

The new responsiveFormulas allow you to add properties for responsiveConfig rules. 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;
        }
    }
});
 
 

These responsiveForumulas then produce these new values, which can be used in any of your responsiveConfig’s. This can 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 benefits from several improvements (such as some stock marker sprites like arrows, diamonds, etc). We’ve also modified our build process to include a packaged version of the sencha-charts package so that users aren’t required to use Sencha Cmd. However, the most significant of these that we documented and exposed custom theme creation.

Chart Themes

Ext JS 5.0.0 shipped charts with several built-in themes that you could select for your charts. However, building custom themes was not a documented process. With this release, we have opened up this ability so that 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',
    alias: 'chart.theme.awesome',
 
    singleton: true,
 
    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 Ext.chart.theme.Base reference for the available configs.

To use the above you would simply set the “theme” config on your charts:

 
 
theme: 'awesome'
 
 

Sencha Cmd

Last but not least, Sencha Cmd 5.0.1 expands upon options available in app.json. This gives you more fine-grained control to configure your application 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:

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

That single setting 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 such from enabling compiler optimizations to tuning the microloader.

To learn more about these new available options, please open app.json and review the robust commenting.

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, we can make an application that builds for web, iOS and Android. Further, we can specify local Cordova builds for Android and use the PhoneGap Cloud Build for iOS since iOS requires a Mac.

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"  // Any OS can build Android
        "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:

 
 
sencha app build ios
sencha app build android
 
 

Of course, you will need to have Cordova and PhoneGap installed and you will also need to configure your PhoneGap Build account. Other than formalities, you can see how this property cleans up the build process. Using this approach also frees you up to add “testing” to any of these builds and get uncompressed JavaScript code for debugging.

Extjs5.1中的新特性的更多相关文章

  1. Extjs5.0中的新特性

    We are excited that Ext JS 5 is now available! Ext JS 5 introduces many new and exciting improvement ...

  2. ASP.NET 5与MVC 6中的新特性

    差点忘了提一句,MVC 6中默认的渲染引擎Razor也将得到更新,以支持C# 6中的新语法.而Razor中的新特性还不只这一点. 在某些情况下,直接在Web页面中嵌入某些JSON数据的方式可能比向服务 ...

  3. Webpack 3 中的新特性

    本文简短地分享下最新发布的 Webpack 3 中的新特性,供大家参考. 1. Webpack 3 的新特性 6 月 20 日,Webpack 发布了最新的 3.0 版本,并在 Medium 发布了公 ...

  4. 使用示例带你提前了解 Java 9 中的新特性

    使用示例带你提前了解 Java 9 中的新特性 转载来源:https://juejin.im/post/58c5e402128fe100603cc194 英文出处:https://www.journa ...

  5. HTML 5中的新特性

    HTML 5中的新特性 html5新增了一些语义化更好的标签元素.首先,让我们来了解一下HTML语义化. 1.什么是HTML语义化? 根据内容的结构化(内容语义化),选择合适的标签(代码语义化)便于开 ...

  6. (数据科学学习手札73)盘点pandas 1.0.0中的新特性

    本文对应脚本及数据已上传至我的Github仓库https://github.com/CNFeffery/DataScienceStudyNotes 1 简介 毫无疑问pandas已经成为基于Pytho ...

  7. 1 PHP 5.3中的新特性

    1 PHP 5.3中的新特性 1.1 支持命名空间 (Namespace) 毫无疑问,命名空间是PHP5.3所带来的最重要的新特性. 在PHP5.3中,则只需要指定不同的命名空间即可,命名空间的分隔符 ...

  8. Firefox 23中的新特性(新陷阱)

    话说有一天突然发现我们的网站页面上的JQuery功能都失效了,Firebug中显示如下的错误 Blocked loading mixed active content "http://xxx ...

  9. Python3中的新特性(3)——代码迁移与2to3

    1.将代码移植到Python2.6 建议任何要将代码移植到Python3的用户首先将代码移植到Python2.6.Python2.6不仅与Python2.5向后兼容,而且支持Python3中的部分新特 ...

随机推荐

  1. Ubuntu配置eclipse

    1.安装jdk 去官网下载最新版jdk,目前是 jdk-8u45-linux-x64.tar.gz 创建Java的目标路径文件夹,这里我们放在/usr/lib/jvm下面.在终端下操作: sudo m ...

  2. WordPress 邮箱防抓取

    现在网络上有很多爬虫,专门四处搜集网站代码中出现的邮箱,搜集到了之后就批量出售或者发送垃圾邮件.很多人都把邮箱中的 “@” 换成 “#”,但这样对用户不太方便,而且这种方法很多机器人都可以识破,同样被 ...

  3. flexigrid

    一.参考资料 1.jQuery插件flexiGrid的完全使用,附代码下载 2.修改flexigrid源码一(json,checkbox)[原创] 3.jQuery +UI + flexigrid做的 ...

  4. toad执行存储过程

    选中存储过程,右键执行,根据存储过程中的sql语句,输入参数, 执行结果的out值点击connection output,鼠标放在statement标签,就会显示下边的out值. 在db2cmd下执行 ...

  5. POJ 1470 Closest Common Ancestors(LCA 最近公共祖先)

    其实这是一个裸求LCA的题目,我使用的是离线的Tarjan算法,但是这个题的AC对于我来说却很坎坷……首先是RE,我立马想到数组开小了,然后扩大了数组,MLE了……接着把数组调整适当大小,又交了一发, ...

  6. static加载问题

    原文地址:http://blog.csdn.net/lubiaopan/article/details/4802430     感谢原作者! static{}(即static块),会在类被加载的时候执 ...

  7. hdu_5555_Immortality of Frog(状压DP)

    题目连接:hdu_5555_Immortality of Frog 题意: 给你一个NxN的网格,第N行的每一列都有个青蛙,这些青蛙只会往上走,上帝会在每个膜中放一个长生不老的药,一共有N个膜,每个膜 ...

  8. 为什么有时候必须添加sys.setdefaultencoding('utf-8')

    今天在尝试Python的CGI模块时遇到中文字符不能正确显示的问题,很郁闷.在网上仔细找了找,终于解决了这个问题,现在将解决方法陈述如下,以防下次失误. 页面源代码如下 #-*- coding: ut ...

  9. listview设置条目点击的时候不变色(让状态选择器不起作用)

    未设置前的效果如下图: 很明显,“酷狗音乐”那个条目被点击的时候,条目背景变为蓝色,怎么去掉这个颜色呢? java代码可以这么写: listView.setSelector(new ColorDraw ...

  10. DIV 浮动存不占空间

    DIV 浮动存不占空间比如<div style="width:80px; border:1px solid #333"><div style="floa ...