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 8306249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:17:40+00:00 2026-06-08T18:17:40+00:00

I am trying to close a window after executing a function that is not

  • 0

I am trying to close a window after executing a function that is not defined in the same file as the window.

I’ll try to explain the structure of the classes involved:

there are 2 classes, Class1.js and Class2.js, in Class1.js there is defined a function function1(){} and function2(){} is defined in Class2.js

How it works:

function2 it’s called in Class1.js, openning a window and it receives as parameter function1 like:

function2(function1);

function1 it’s executed when a button is clicked on the new window, defined also in Class2.js:

var win = new Ext.Window({  
    id: 'win that I want to close',
    .  
    .  
    .   
    buttons: [{  
              id: 'button that activates function1',  
              text: 'button1',  
              listeners: {  
                    click:  function1  
                  },  
                  scope: win  
              },
              .
              .
              .
             ]

});  
win.show();

In Class1.js, at function1 I try to do:

if(this.id == 'win that I want to close'){
    this.close();
}

But the scope that I get is the one from the button in the new window, not the window’s scope, so I cannot close it.

I know that my explanation is quite bad, but is not easy to explain and I am totally stuck at this point.

Congratulations you if you tryied to undestand what I wrote, you are very brave! and Thank you for your help!

  • 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-08T18:17:40+00:00Added an answer on June 8, 2026 at 6:17 pm

    I have the solution:

    listeners: {
        'click': {
            fn: function1,
            scope: {
                winid: 'win that I want to close'
            }
        }
    }
    

    And with that I can get the element with Ext.getCmp(this.winid) from Class1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to close a child window with JavaScript, and in Firefox everything works
Possible Duplicate: Cross-thread operation not valid I am trying to close the base of
i am trying to write a program that close explorer then runs another program.
I am trying to use the below code to close the window. But getting
I don't know how to do that, because ProgressMonitor window is self-invoked (after 2
I'm trying to manually close a Jquery Dialog window on button click without using
After deploying my rails 3 app in production I noticed that paths are not
I have the following code in a file called overlay.js: Event.observe(window, 'load', function() {
I am trying to close a memcached connection to start a new one. But
I'm trying to close the distance between the checkboxes and the labels. I would

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.