1. Extending a "Ext.ux.Chart.amChart.Component" has problems. Observe the following:
PHP Code:
Chart = Ext.extend(Ext.ux.Chart.amChart.Component, {
chartURL: "my_custom_swf_url"
});
var chart = new Chart();
alert(chart.chartURL);
chart.chartURL returns ""
The properties are not retained as you'd expect them to be. It's because you've defined your Ext.ux.Media.Component constructor as follows:
PHP Code:
constructor : function(config){
//Inherit the ux.Media class
Ext.apply(this , config, this.mediaClass.prototype ); // <-- problem area
ux.Component.superclass.constructor.apply(this, arguments);
},
And as a result overriding properties or methods isn't possible! The following will work instead:
PHP Code:
constructor : function(config){
//Inherit the ux.Media class
Ext.applyIf(Ext.ux.Media.Component.prototype, this.mediaClass.prototype);
Ext.apply(this , config);
ux.Component.superclass.constructor.apply(this, arguments);
},
2. (minor detail) The initComponent is always called without arguments, if you look at the native component initialization process (Component.js).
PHP Code:
initComponent : function(){
ux.Component.superclass.initComponent.apply(this,arguments);
componentAdapter.init.apply(this,arguments);
},
So you don't need the arguments part.
3. getInterface() returns the mediaObject and reloadData isn't part of the mediaObject.
reloadData is part of the externalsNamespace ( which is set to 'chart') so you can access it as this.chart.reloadData or this[this.externalsNamespace].reloadData.
Therefore your code fails here:
PHP Code:
setChartDataURL : function(url, immediate){
var o;
this.dataURL = url;
if(url && (o = this.getInterface()) && immediate !== false){
o.reloadData(encodeURI(this.prepareURL(url))); // <-- o.reloadData() fails!
}
return this;
}