PDA

View Full Version : Overloading Ext.Window



silcreval
9 Nov 2009, 12:23 AM
I'm creating a Window with

var a = new Ext.Window({

... various settings ...

myFunction: function(){
Ext.Msg.alert("hello");
}

}


I've noticed that within the function created above, I often have to refer
to internal functions using a.myFunction rather than this.myFunction.

What's the best way to overload an Ext.Window class so I can use
this to refer to internal functions?

Thanks.

Animal
9 Nov 2009, 12:32 AM
Call it in the correct context.

The "this" reference is imposed at invocation time in Javascript.

If you use



a.myFunction()


"this" will be a.

I assume you are just passing it as a handler or a callback, and still blithely forgetting the scope option after all this time.

silcreval
9 Nov 2009, 2:57 PM
Thanks. I need to go back and rework that.