PDA

View Full Version : scope and functions



ajay.kumar2
16 Nov 2010, 9:50 PM
i have a custom component which extends from Ext.Container i.e



Ext.extend(Ext.Container, {
initComponent: function(){

},
functionOne:function(){

},
functionTwo:function(){
}
}

How can i access functionOne in functionTwo or vice-versa ?

thanks,

ajay.kumar2
16 Nov 2010, 9:54 PM
I got it using

Ext.extend(Ext.Container, {
initComponent: function(){

},
functionOne:function(){

} ,scope:this,
functionTwo:function(){
} ,scope:this
}
[/CODE]

thanks,


i have a custom component which extends from Ext.Container i.e



Ext.extend(Ext.Container, {
initComponent: function(){

},
functionOne:function(){

},
functionTwo:function(){
}
}

How can i access functionOne in functionTwo or vice-versa ?

thanks,

VinylFox
16 Nov 2010, 10:14 PM
Woah! that's not correct.

Scope is dependent on how your function is called, so the mechanism used to call your function determines the scope.

In other words, you should be asking how to call your function in a particular scope which will allow you to access your two functions from one another.

ajay.kumar2
17 Nov 2010, 3:53 PM
Hey Vinyl,

thanks for the reply, its gud you corrected me.

So what is the correct way to access function1 in function2 ?


Woah! that's not correct.

Scope is dependent on how your function is called, so the mechanism used to call your function determines the scope.

In other words, you should be asking how to call your function in a particular scope which will allow you to access your two functions from one another.