|
| attachEvent in base class |
 |
Tue, 26 Sep 2006 06:57:21 +000 |
I have created a base class called Part and inside this class im hooking up a
onclick event to a method called toggleMinimize. If I create a instance of the
Part class all i well.
However if I inherit from the baseclass Part and create a class called Search
and then create a instance of the search class the event hook-up in the base
class does not work properly. The event is hooked up and everything, but when I
fire the event by pressing the button I get a javascript error "method is
null" or something like that.
Does anybody know what Im doing wrong? Here are my classes (short version):
Type.registerNamespace("Parts");
Parts.Part = function(){
...
this.initialize = function(){
...
$(oInput).attachEvent('onclick', Function.createDelegate(this,
this.toggleMinimize));
}
this.toggleMinimize = function(){
alert("hello");
}
Parts.Part.registerBaseMethod(this, 'initialize');
}
Parts.Part.registerClass('Parts.Part', null, Sys.IDisposable);
Parts.Search = function(){
Parts.Search.initializeBase(this);
this.initialize = function(partWindow){
Parts.MapClient.getBaseMethod(this,"initialize",
"Parts.Part")();
}
}
Parts.Search.registerClass('Parts.Search', 'Parts.Part', Sys.IDisposable);
|
| Post Reply
|
| Re: attachEvent in base class |
 |
Tue, 26 Sep 2006 09:20:16 +000 |
Hi,
I'm not sure you can pass a string with the name of the parent class. I think
you have to pass a reference to the base class:
Parts.Search.registerClass('Parts.Search', Parts.Part, Sys.IDisposable);
|
| Post Reply
|
|
|
|
|
|
|
|
|
|