Reputation: 263
I want to override initComponent( ) method of Ext.grid.column.Column class. But some how it executes all those lines. Basically I want to remove listeners from element and wants to assign it to other Element.
Ext.override(Ext.grid.column.Column,
{
initComponent: function(){
.
. //All lines are as it is till me.callParents();
.
.
.
.
.
.
.
// Initialize as a HeaderContainer
me.callParent(arguments);
me.on({ <<<------------------------------Do not need these.
element: 'el',
click: me.onElClick,
dblclick: me.onElDblClick,
scope: me
});
me.on({ <<<------------------------------Do not need these.
element: 'titleEl',
mouseenter: me.onTitleMouseOver,
mouseleave: me.onTitleMouseOut,
scope: me
});
}
}
I do not want to attach listeners to "el" and "titleEl" so i remove those lines. But some how it still add listeners. I also write me.un() in AfterRender function. even tho it adds listener to "El" and "titleEl"
can anybody please guide me where i am wrong?????
Upvotes: 2
Views: 2257
Reputation: 6995
Instead of using Ext.override
, use Ext.define
to create a sub-class. When you redefine the initComponent
method, you can use this.superclass.superclass.initComponent.call
to skip over Ext.grid.column.Column#initComponent
.
Ext.define('MyApp.grid.column.Column', {
extend: 'Ext.grid.column.Column',
alias: 'widget.mycolumn',
initComponent: function(){
// Pre-initComponent from column class here
// Ext.grid.header.Container#initComponent
this.superclass.superclass.initComponent.call(this);
// Do optional stuff here
}
});
Then when you create your new columns, use xtype: 'mycolumn'
to use your own implementation while still being able to use regular columns as needed.
Upvotes: 2