PDA

View Full Version : How to properly overload Ext.Window



silcreval
7 Nov 2009, 5:44 AM
I've created a window with

var w = new Ext.Window({

... various settings ...

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

}

everything works fine, but I've noticed that if I want to call a user
defined function (eg myfunction) from within the Window I've
created, I have to refer to the variable 'w' rather than this.

eg

w.myfunction()

rather than

this.myfunction()

This doesnt seem quite right, and I'm wondering do I need to overload
Ext.Window with Ext.extend to do it properly?

Thanks

Condor
7 Nov 2009, 6:25 AM
Your code is correct, but you are calling myfunction from a method that has a different scope (an event handler perhaps?).