PDA

View Full Version : Extend a class without overriding using xtype



debarshi1990
6 Nov 2013, 9:35 PM
I have a class defined

Ext.define('Ext.WorklistGrid', {
extend: 'Ext.grid.Panel',
alias: 'widget.workList',
title: "Worklist",
autoExpandColumn: "1",
tools: [
{
type: 'maximize'
}
]
});

Now i want to extend it using xtype only.
xtype: 'workList',
tools:[
{
type: 'gear'
}
]

But i want both the maximize and gear tool to come....what can be done here?
Thanks in advance

evant
6 Nov 2013, 9:39 PM
You'd need to merge them:



initComponent: function() {
var toAdd = {type: 'maximize'};
if (this.tools) {
this.tools.push(toAdd);
} else {
this.tools = [toAdd];
}
this.callParent();
}