Results 1 to 2 of 2

Thread: How to confirm window closing

  1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    1
    Vote Rating
    0
      0  

    Default Unanswered: How to confirm window closing

    Greetings,

    I'm noob in JS and Ext. My first js 'hello world' was yesterday...

    Well. The idea was to ask user if he really want to close window. The result is:

    Code:
    function confirm_close()
    {
    Ext.Msg.confirm('????','?? ????????????? ???? ?????????',
    function(answer){
    if (answer == 'yes'){
    ras4window.destroy(); }
    }
    );
    } function window_on_create(){ ras4window=Ext.create('Ext.window.Window', {
    title: '??????',
    height: 200,
    width: 400,
    layout: 'fit',
    listeners:{
    beforeclose: function() {
    confirm_close();
    return false;
    }
    },
    items: { }
    }).show();
    Is there any better ways of doing this?

    P.s. my english is bad. sorry.

  2. #2
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    603
    Answers
    67
    Vote Rating
    284
      0  

    Default

    That looks pretty good. I would probably organize the code differently, but the concept of returning false from beforeclose and showing a confirm dialog is correct.

Tags for this Thread

Posting Permissions

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