Moving Mixin to Extjs

There is a mixin class that combines methods into a target class. I want to know when the merger process begins?

I overridden one of the mixin methods, but it did not override in the target class. Therefore, I assume that the merger comes before redefinition.

Ext.define('Ext.container.DockingContainer',
...
Ext.define('Ext.panel.Panel',
...
Ext.override(Ext.container.DockingContainer

Ext.js first defines the mixin, and then the target class. When I override the mixins method, this does not affect the target class method. So how to solve this problem? How to replace mixins method correctly?

+4
source share
1 answer

I redefined it as follows:

Ext.define('Ext.overrides.container.DockingContainer', 
{    
    override: 'Ext.container.DockingContainer',
    getDockedItems: function(selector, beforeBody) 
    {
          ....
    }
}, function() {
        Ext.Object.each(Ext.ClassManager.classes, function(name, cls) {
            if (cls.prototype && cls.prototype.mixins && cls.prototype.mixins.hasOwnProperty("docking")) {
                cls.prototype.getDockedItems = this.prototype.getDockedItems;
            }
        }, this);
    }
);
+1
source

Source: https://habr.com/ru/post/1671038/


All Articles