Results 1 to 9 of 9

Thread: [SOLVED] Scope lost, cant find the function

  1. #1
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382
    Vote Rating
    1
      0  

    Default [SOLVED] Scope lost, cant find the function

    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
    Code:
    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?
    Last edited by Elijah; 9 Apr 2010 at 8:31 AM. Reason: solved

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890
    Vote Rating
    90
      0  

    Default

    Well tell Ajax what scope! It's in the manual!

  3. #3
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890
    Vote Rating
    90
      0  

    Default

    And read yr code. Obviously, you have to specify the function as "this.createWindowFinal". That's where you keep a reference to it!

  4. #4
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382
    Vote Rating
    1
      0  

    Default

    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.

  5. #5
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382
    Vote Rating
    1
      0  

    Default

    As I commented above I did try the this.createWindowFinal() but it still could not find the function.

  6. #6
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676
    Vote Rating
    9
      0  
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  7. #7
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382
    Vote Rating
    1
      0  

    Default

    Sadly to say yes it was.

    Code:
            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.

  8. #8
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750
    Vote Rating
    12
      0  

    Default

    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.

  9. #9
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382
    Vote Rating
    1
      0  

    Default

    Thanks Fay

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •