PDA

View Full Version : Problems extending a class that extends another class



ascii
20 Feb 2013, 11:59 AM
I have created a custom histogram class, which is very generic. I extended it to create a timeline class which is more specific to my application (the bars represent months). So I have something like:

Ext.define("foo.Histogram", {
extend: 'Ext.panel.Panel',
......
});
Ext.define("foo.Timeline", {
extend:"foo.Histogram",
...
});

var b = Ext.create("foo.Histogram", {}); // Works ok
var bar = Ext.create("foo.Timeline", {}); // Does not work


Now I can instantiate a foo.Histogram and include it in a vbox. However, when I try to instantiate foo.Timeline I get the error 'me.self.prototype is undefined' within the getLayout() function in Extjs.

Am I trying to do something that cannot be achieved in ExtJS? Or is there something else I need to do?

vadimv
20 Feb 2013, 12:28 PM
At first look seems ok, but the posted code is not enough to find the reason of your issue, better to post all code...maybe you forgot to call callParent somewhere in your extensions...

ascii
20 Feb 2013, 1:19 PM
Thanks but I found the problem. I had defined self:this, which in the context was the window, not the object itself.