Results 1 to 10 of 22

Thread: API Changes in Ext JS 4.1

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User dongryphon's Avatar
    Join Date
    Jul 2009
    Vote Rating

    Default API Changes in Ext JS 4.1

    ** UPDATE: The content of this thread has been summarized in the following Guide. If we've missed anything, please start a new thread to let us know. And thanks for all your help! **!/guide/upgrade_41

    This thread is intended to capture all the breaking changes as we encounter them. It was our goal to avoid breaking or changing our API as much as possible in this release, despite the scope of the internal changes. In many cases then, if the API has changed in 4.1, this could be a bug that we need to address. In some cases, the API change may be necessary.

    I will try to keep the running list up to date in this post as folks reply with their findings.

    API Change Resoluton
    Component render Only called on top-most components In previous releases, the render method was used to render all components in a top-down traversal. In 4.1, rendering is performed in memory as markup which is then written to the DOM. This means that the render method of child components is not called. Code in the render method should most likely move to either beforeRender (new to 4.1) or afterRender. For best performance, it is desirable to make style or add/removeCls adjustments in beforeRender so that these values will be generated in the initial markup and not made to the DOM element as it would be in afterRender.
    Component onRender Elements now exist in DOM at time of call In previous releases, the component's primary element ("el") was created when the parent class method was called. This is no longer possible due to bulk rendering. Any logic that was performed prior to calling the parent method can be moved to the new beforeRender method
    Component renderTpl Render Templates now call helper methods As part of bulk rendering, a renderTpl now calls helper methods on the template instance to inject content and container items. This can be best seen in the default renderTpl for Components:
    PHP Code:
    and Containers:
    PHP Code:
    callParent in override calls overridden method This was changed as part of formalizing Ext.define/override. In 4.1, it is now possible to name and require overrides just as you would a normal class:
    PHP Code:
        Ext.define('My.patch.Grid', {

    foo: function () {
    this.callParent(); // calls
    The above code in 4.0 would have called the base class "foo" method instead. The callOverridden method was needed to do the above. To bypass the overriden method, you just need to do this:
    PHP Code:
        Ext.define('My.patch.Grid', {

    foo: function () {
    It is possible for a class to even "require" its own overrides. This enables breaking up a large class into independent parts expressed as overrides (a better approach than "AbstractFoo" and "Foo").
    FocusManager subscribe For details, see
    Component doComponentLayout This method can still be called to perform a layout of the component, but its internals are quite different. As a component author, this method can no longer be overridden to perform a custom layout since it will not be called internally. Instead you can override afterComponentLayout which is given the new size and old size as parameters or you can respond to the resize event. If you are writing a derived component, the method override should be preferred - just don't forget to callParent.

    One other note: the size of the component should not be changed by this method. The size has been determined already. If the size is changed again, this could lead to infinite recursion at worst (since afterComponentLayout will be called again) or just wrong layout.
    config setters are called to set default values In 4.0, the config mechanism in Ext.define would create getter and setter methods, but the default value would bypass the setter. In this build, we have a partial solution that uses initter methods but that will change to sync with Touch 2 and will simply call the setter. This can effect the timing of the first call to the setter method but is needed because setters were designed to enable transformation-on-set semantics. In Beta 1, this timing is much closer to 4.0. The model store property is now an array of stores. A single record can belong to more than 1 store, especially in the case of a tree. As such, we need to track a list of all the stores that the model belongs to
    Ext.layout.container.Border Split components are added to the container When configuring components with split: true, the layout will now insert extra splitter components as siblings of the current components. This allows for the layout to be much less complicated and also allows the ability to dynamically modify regions.

    Fixed in Beta 1

    API Change Resoluton
    Component style config CSS names cannot be 'camelCase' This is a bug in the bulk rendering mechanism. We need to de-camelize these names into proper CSS names.
    Last edited by dongryphon; 12 May 2012 at 1:34 PM. Reason: Added stores for model
    Don Griffin

    "Use the source, Luke!"

Posting Permissions

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