0

What's the difference between these 2 override

So option 1:

Ext.window.Window.override({
    initComponent: function () {
        this.draggable = false;
        this.resizable = false;

        this.on('resize', function () {
            this.center();
        });

        this.callParent();
    }
});

option 2:

Ext.define('Ext.window.WindowOverride', {
    override: 'Ext.window.Window',

    initComponent: function () {
        this.draggable = false;
        this.resizable = false;

        this.on('resize', function () {
            this.center();
        });

        this.callParent();
    }
});

Which approach should I follow and why?

Specifically using Extjs 4.1.1

code4jhon
  • 5,725
  • 9
  • 40
  • 60

1 Answers1

4

The second option is basically a wrapper for the first one; it will apply overrides after Ext.window.Window has been loaded.

Calling Class.override() is a relic of Ext JS 3.x days, when there was no dynamic class loading available and you had to take care of the plumbing yourself. There is no reason to use it with 4+.

Alex Tokarev
  • 4,821
  • 1
  • 20
  • 30