PDA

View Full Version : this.addEvents is not a function error



hworg
19 Jun 2009, 5:19 AM
i've got a problem with an extension i'm working on at the moment and i can't seem to figure it out. i'm getting 'this.addEvents is not a function' from firebug. all the searches i've done suggest that a missing 'new' is the problem, but i can't spot anywhere that is relevant(maybe i just need another set of eyes), so i'm hoping someone can give me a heads up since i'm still not 100% confident with extending.

thanks

code is -


Ext.namespace('generation.core');

generation.core.help = Ext.extend(Ext.Window({

url: 'index.php',

application: '',

width: 300,

height: 500,

autoScroll: true,

bodyStyle: 'padding: 5 5 5 5;',

initComponent: function() {

Ext.apply(this, {

layout: 'card',

data: new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: this.url,
}),
reader: new Ext.data.JsonReader({
totalProperty: 'pages',
root: 'help',
fields: [
'title',
'content'
],
}),
baseParams: {
action: 'help',
application: this.application,
},
}),

bbar: [
'->',
{
id: 'card-prev',
text: 'Previous',
iconCls: generation.core.registry.load_icon('resources/icons/24x24/back.png'),
scale: 'medium',
}, '->', {
id: 'card-next',
text: 'Next',
iconCls: generation.core.registry.load_icon('resources/icons/24x24/next.png'),
iconAlign: 'right',
scale: 'medium',
}
],

});

generation.core.help.superclass.initComponent.call(this);

this.template = new Ext.XTemplate(
'<h1 class="generation-help-title">{title}</h1>',
'<p>{$content}</p>'
).compile();

this.addPage = function(record) {
page = {
html: this.template.apply(record.data)
}
this.add(page);
}

this.data.load();
this.data.each(this.addPage, this);

this.setTitle('Help - ' + Ext.util.Format.capitalize(this.application));

}

}));

hworg
19 Jun 2009, 5:49 AM
ah found the problem on the second line...