class App < Netzke::Basepack::SimpleApp
[...]
js_method :init_component, <<-JS
function(){
[...]
// Load the main component
this.appLoadComponent('main');
}
JS
component :main, :class_name => "Main"
end
class Main < Netzke::Basepack::TabPanel
def configuration
res = super
res.merge(items => [:sub_component.component])
end
component :sub_component, :class_name => "SubComponent"
end
class SubComponent < Netzke::Basepack::TabPanel
def configuration
res = super
res.merge(items => [:sub_sub_component.component])
end
component :sub_sub_component, :class_name => "SubSubComponent"
end
What happens, after this.appLoadComponent('main'); is executed, is that netzke complains that it can't find sub_sub_component:
Netzke: unknown component reference sub_sub_subcomponent
I guess, the reason for that is the fact that
detectComponents
just checks this.netzkeComponents and doesn't go any deeper.
But that's just a guess.
The following patch in base.js fixed it for me:
detectComponents: function(o, netzkeComponents){
if(netzkeComponents == null){
netzkeComponents = this.netzkeComponents;
}
if (Ext.isObject(o)) {
if (o.items) this.detectComponents(o.items);
} else if (Ext.isArray(o)) {
var a = o;
Ext.each(a, function(c, i){
if (c.netzkeComponent) {
var cmpName = c.netzkeComponent,
cmpCfg = netzkeComponents[cmpName.camelize(true)];
if (!cmpCfg) throw "Netzke: unknown component reference " + cmpName;
a[i] = Ext.apply(cmpCfg, c);
delete a[i].netzkeComponent; // not needed any longer
} else if (c.items) {this.detectComponents(c.items, c.netzkeComponents);}
}, this);
}
}
Hi,
I have the following setup:
What happens, after
this.appLoadComponent('main');
is executed, is that netzke complains that it can't find sub_sub_component:Netzke: unknown component reference sub_sub_subcomponent
I guess, the reason for that is the fact that
just checks
this.netzkeComponents
and doesn't go any deeper. But that's just a guess.The following patch in base.js fixed it for me: