Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8879721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:00:48+00:00 2026-06-14T20:00:48+00:00

I have trouble using scope in nested functions. My code is below and also

  • 0

I have trouble using scope in nested functions. My code is below and also errors is stated in the code. How can I pass scope to nested functions?

this.store_1.load({
    params  :{start:0, limit:20},
    callback: function(records, operation, success)
    {
        this.store_2.load({
            params      : {argID: argID},
            callback    : function(records, operation, success) {

                var my_data = this.store_2.data.items[0].data;  

                this.my_rowExpander = new Ext.ux.grid.RowExpander({
                    tpl : new Ext.Template(template_str)
                });

                this.MyDetailGraph = this.getMyGraph(graphDataArr);

                this.MyDetailSummaryPanel = new Ext.Panel({ 
                        html    : this.getMyDetailSummary_Template(arg1, arg2, arg3),
                        title   : 'Title'
                });

                this.myPagingBBar = new Ext.PagingToolbar({
                      pageSize      : 20,
                      buttonAlign   : 'center',
                      store         : this.store_1,
                      doRefresh     : function(){
                            this.store.load({ // if I use this.store_1.load gives error this.store_1 is undefined
                                params  :{start:0, limit:20},
                                callback: function(records, operation, success)
                                {   
                                    // here gives error -->  this.updateDetailGraphValue is not a function
                                    this.updateDetailGraphValue(arg1, this.MyDetailGraph, arg2);
                                    // here must be an error like above
                                    this.updateDetailSummaryPanelValue(this.MyDetailSummaryPanel, arg1, arg2, arg3);
                                }
                            });
                      }
                });

                this.MyDetailGrid = new Ext.grid.GridPanel({
                    store       : this.store_1,
                    bbar        : this.myPagingBBar,
                    plugins     : this.my_rowExpander,
                    columns     :[
                                    this.my_rowExpander,
                                    {header: 'header1'},
                                    {header: 'header2'},
                                    {header: 'header3'},
                                    {header: 'header4'}
                                 ]
                });

                argPanel.items.insert(0, this.MyDetailGraph);

                argPanel.items.insert(1, this.MyDetailSummaryPanel);

                argPanel.items.insert(2, this.MyDetailGrid);

                argPanel.doLayout();
            },
            scope       : this
        });
    }, 
    scope : this
});

this.updateDetailGraphValue = function(argMainPanel, argGraph, argDataArray)
{
        this.graph = this.getDetailGraph(argDataArray);
        argMainPanel.remove(argGraph, true);
        argMainPanel.items.insert(0, this.graph);
        argMainPanel.doLayout();
};

this.updateDetailSummaryPanelValue = function(argPanel, arg1, arg2, arg3)
{
        argPanel.update(this.getDetailSummary_Template(arg1, arg2, arg3));
        argPanel.doLayout();
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:00:50+00:00Added an answer on June 14, 2026 at 8:00 pm

    I used this in first load and I have defined a global scope which is myGlobalScope then I used myGlobalScope in others:

    this.store_1.load({
        params  :{start:0, limit:20},
        scope: this,
        callback: function(records, operation, success)
        {
    
        var myGlobalScope = this; // I have defined this global scope
    
    
            this.store_2.load({
                params      : {argID: argID},
                scope   : myGlobalScope, // use myGlobalScope instead of this
                callback    : function(records, operation, success) {
    
                    var my_data = this.store_2.data.items[0].data;  
    
                    this.my_rowExpander = new Ext.ux.grid.RowExpander({
                        tpl : new Ext.Template(template_str)
                    });
    
                    this.MyDetailGraph = this.getMyGraph(graphDataArr);
    
                    this.MyDetailSummaryPanel = new Ext.Panel({ 
                            html    : myGlobalScope.getMyDetailSummary_Template(arg1, arg2, arg3), // use myGlobalScope instead of this
                            title   : 'Title'
                    });
    
                    this.myPagingBBar = new Ext.PagingToolbar({
                          pageSize      : 20,
                          buttonAlign   : 'center',
                          store         : this.store_1,
                          doRefresh     : function(){
                                this.store.load({ // if I use this.store_1.load gives error this.store_1 is undefined
                                    params  :{start:0, limit:20},
                                    scope   : this,
                                    callback:  function innerCB(records, operation, success) {   
                        myGlobalScope.updateDetailGraphValue(arg1, this.MyDetailGraph, arg2); // use myGlobalScope instead of this
                            myGlobalScope.updateDetailSummaryPanelValue(this.MyDetailSummaryPanel, arg1, arg2, arg3); // use myGlobalScope instead of this
                    }
                                });
                          }
                    });
    
                    this.MyDetailGrid = new Ext.grid.GridPanel({
                        store       : this.store_1,
                        bbar        : this.myPagingBBar,
                        plugins     : this.my_rowExpander,
                        columns     :[
                                        this.my_rowExpander,
                                        {header: 'header1'},
                                        {header: 'header2'},
                                        {header: 'header3'},
                                        {header: 'header4'}
                                     ]
                    });
    
                    argPanel.items.insert(0, this.MyDetailGraph);
    
                    argPanel.items.insert(1, this.MyDetailSummaryPanel);
    
                    argPanel.items.insert(2, this.MyDetailGrid);
    
                    argPanel.doLayout();
                }
            });
        }
    });
    
    this.updateDetailGraphValue = function(argMainPanel, argGraph, argDataArray)
    {
            this.graph = this.getDetailGraph(argDataArray);
            argMainPanel.remove(argGraph, true);
            argMainPanel.items.insert(0, this.graph);
            argMainPanel.doLayout();
    };
    
    this.updateDetailSummaryPanelValue = function(argPanel, arg1, arg2, arg3)
    {
            argPanel.update(this.getDetailSummary_Template(arg1, arg2, arg3));
            argPanel.doLayout();
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Little trouble in using css, in the below code, i have used odd and
I'm having trouble understanding using D3 events and dispatch functions. I have a chart
I have a little trouble understanding scope and lifetime using javaScript and jQuery. I
Interesting issue here, optimising some code but am having trouble with scope issues using
I'm having trouble restricting the scope of my broadcasts, using Atmosphere 0.7.2. I have
I have trouble using sed. I need to replace some lines in very deprecated
I have trouble parsing a HTML table using Nokogiri and Ruby. My HTML table
I am have trouble converting my xml using XSLT back to xml in the
Having a bit of trouble using the List.Find with a custom predicate i have
I'm having some trouble using constraints correctly. I have three tables, 'item', 'store' and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.