In ExtJS 3.2 I extended a class which is not part of the ExtJS framework (the OpenLayer.Map class) with the folowing code:
Code:
MyMap = Ext.extend(OpenLayers.Map, {
constructor: function() {
config = {
div: 'olMap',
projection: 'EPSG:28992'
// ... other config settings
}
MyMap.superclass.constructor.call(this, config)
},
myFunction: function() {
//Do something
}
});
This all worked fine, the constructor above created a OpenLayer.Map instance and returned it. But now I'm upgrading to ExtJS 4 and would like to do exactly the same, but I can't make it work. The code I have so far is this:
Code:
Ext.define('MyMap', {
extend: 'OpenLayers.Map',
constructor: function() {
config = {
div: 'olMap',
projection: 'EPSG:28992'
// ... other config settings
}
this.callParent(arguments);
this.initConfig(config);
},
myFunction: function() {
//Do something
}
});
The constructor above doesn't create return an instance of OpenLayers.Map though. I thought that this.callParent in the constructor should create a instance it's parent class (OpenLayer.Map), but is does not. So now I am wondering how can I extend a class other than an ExtJS class?