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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:11:27+00:00 2026-06-04T07:11:27+00:00

I have I view that extends Ext.grid.Panel and I want to be able to

  • 0

I have I view that extends Ext.grid.Panel and I want to be able to ask the user if he really wants to close the panel after he clicks [X]. I tried with

listeners: {
            beforedestroy: function() {
                               //console.log('In');
                return false;
            }
        },

but obviously it’s not that simple. Any ideas on how to prevent the closing of the panel?

Thanks

Leron

P.S.

This is what I get from sencha forums, haven’t test it yet:

Ext.create( 'Ext.window.Window', {
    title: 'test',
    width: 200,
    height: 200,
    listeners: {
        beforeclose: function( window ) {
            Ext.Msg.confirm( 'Hey', 'Are you sure you want to close?', function( answer ) {
                if( answer == "yes" ) {
                    window.destroy();
                }
            } );
            return false;
        }
    }
} ).show(); 
  • 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-04T07:11:28+00:00Added an answer on June 4, 2026 at 7:11 am

    beforeclose event should work. No?

    Update:

    If you want to have some user interaction (i.e. confirmation question or saving data or something like that) it will be a bit tricky…

    First, in the constructor of the view do something like this:

    this.on('beforeclose', function() { 
       return this.myCloseHandler(function() { this.close(); }, this);
    });
    this.alreadyAsked = false;
    

    Than create handler:

    myCloseHandler: function(callback, scope) {
        if (this.alreadyAsked === false) {
            this.alreadyAsked = true;
            Ext.MessageBox.show({
                msg: 'Are you sure?',
                fn: function(btn) {
                   if (btn == 'yes')
                      Ext.callback(callback, scope);
                   else 
                      this.alreadyAsked = false;   
                }
            });
            return false;
    
        }
        return true;   
    }
    

    Idea is – you return false immediately but have some flag and condition to go through the same logic without confirmation.

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

Sidebar

Related Questions

I have a view designed like that: Ext.define('MY.view.NotificationMails', { extend: 'Ext.grid.Panel', alias: 'widget.NotificationMailsPanel', id:
I have view that extends ViewPart . In this view, I want to add
I have a custom-made view that extends the View class. I would like 2
I have a class that extends View. I override the onDraw method and allow
I have a view that shows user profile fields in a tabular format. There
I have a View that is basically setup like this: <Grid> <ViewBox> <Grid> <ItemsControl
I created an object that extends android.view.View , overriding draw() and have it displaying
I have a fieldset like this : Ext.define('admin.view.BuzzEditForm', { extend: 'Ext.form.Panel', requires: ['Ext.form.FieldSet','Ext.Img'], id:
I have a class that extends View , and I draw everything I need
I have a custom view that extends ViewGroup . It includes a ProgressBar 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.