Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mixin overriding in Extjs

Tags:

mixins

extjs

There are mixin class that merges methods to target class. I want to know when merging process starts?

I've overridden one of the methods of mixin, but it hasn't been overrode in target class. So I assume that merging goes before overriding.

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

At first ext.js defines mixin, then target class. When I override mixins method, it doesn't impact target classes method. So how to solve this problem? How to override mixins method properly?

like image 566
Makha Avatar asked Oct 30 '22 11:10

Makha


1 Answers

I've overridden it with this way:

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);
    }
);
like image 165
Makha Avatar answered Dec 10 '22 01:12

Makha