PDA

View Full Version : [SOLVED] Scope lost, cant find the function



Elijah
9 Apr 2010, 6:54 AM
Im using the desktop example as a building base for an app and I am having an issue with calling a function from within success: function{}

the desktop has its' init block that calls the createWindow function. Inside of the createWindow I have an Ext.Ajax.request() call

Structure would be like the following


MyDesktop.MyTestWindow = Ext.external(Ext.app.Modules, {

init : function(){},

createWindow : function(){
Ext.Ajax.request(){
...
success: function(respones, options){
createWindowFinal(); // I also tried this.createWindowFinal();
}
...
}
},

createWindowFinal : function(){}
}) // MyTestWindow


My issue is that I need to call the createWindowFinal after the ajax call succeeds but it cant find it.
What is the correct syntax to use to call that method?

Animal
9 Apr 2010, 6:59 AM
Well tell Ajax what scope! It's in the manual!

Animal
9 Apr 2010, 7:00 AM
And read yr code. Obviously, you have to specify the function as "this.createWindowFinal". That's where you keep a reference to it!

Elijah
9 Apr 2010, 7:07 AM
What exactly am I looking for in the Ajax section of the manual? I'm looking but it is not clear to me as to HOW I can set the scope.

I see some option arguments listed in methods but its not clear how I am to pass to them or set it.

If you would not mind please specify Exactly where in the Ajax portion of api I should be reading. Thanks.

Elijah
9 Apr 2010, 7:09 AM
As I commented above I did try the this.createWindowFinal() but it still could not find the function.

steffenk
9 Apr 2010, 7:22 AM
so difficult?
http://www.extjs.com/deploy/dev/docs/?class=Ext.data.Connection&member=request
look in parameters

Elijah
9 Apr 2010, 7:44 AM
Sadly to say yes it was.



Ext.Ajax.request(){
...
scope: this,
success: function(respones, options){
this.createWindowFinal(); // works
}
...
}

Would have been alot less frusterating if someone simpley said to do the above.

But thank you for pointing me to the request section in API.

Also, I still cant find the menu options on this form to mark items as solved. Its not under the Thread Tools for me.

fay
9 Apr 2010, 8:17 AM
Also, I still cant find the menu options on this form to mark items as solved. Its not under the Thread Tools for me.

Edit your original post, click "Go Advanced", and add "[SOLVED]" to the post's Title.

Elijah
9 Apr 2010, 8:31 AM
Thanks Fay