View Full Version : Extending windows versus var definition

6 Nov 2009, 2:26 PM
I've got a simple ExtJS window defined like this
(its cut down massively, but just gives the idea)

var myWin = Ext.Window({
.. various initial settings ...

myFunction: function(){

myOtherFunction: function(){

One thing I find, is that when I define a window like this I
have to use the variable name 'myWin' when referring to
user defined functions in the window. eg. above I'm
calling myFunction from myOtherFunction.

I'm wondering why I cant use 'this' to refer to the function,
and I'm guessing that this is because I need to extend
Ext.Window rather than define it in this way?

Everything works fine, it just doesnt feel totally right.

6 Nov 2009, 11:20 PM
You can use 'this', but you have to make sure that myOtherFunction is called with the correct scope (myWin).