2012-01-01

ExtJS 4.0 - Class system, object inheritance and config

Recently we've started using the new Ext-JS 4.0 class system.

one of the obstacles I came across with was using the configuration while making inheritance.

On most of the examples in the web - it works seamlessly perfect.
but what happens when you try to extend an existing object?
for example, 'Ext.panel.Panel' ?

Suddenly - weird stuff happens and it doesn't work any longer.

So for example:
Ext.define('ProductionMap.popup.serverExplorer', {
extend: 'Ext.panel.Panel',

config: {
ParameterConfig: '',
},

constructor: function (cfg) {
this.initConfig(config);
return this;
},

initComponent: function () {
...
}


will give an error.
took me an hour to figure it out - but I found the solution and it's REALLY simple.
It's all about the constructor:
instead of that code, use:

constructor: function (cfg) {
this.initConfig(config);
this.callParent([config]);
return this;
},


and kaboom - works like a charm :)

Liad

No comments:

pip install pymssql fails with 'sqlfront.h': No such file or directory

I've tried to install pymssql on Windows using command line: pip install pymssql The operation fails with an error: fatal error C108...