1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    1
    Vote Rating
    0
    Amadey is on a distinguished road

      0  

    Default Unanswered: How to confirm window closing

    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 Premium Member Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Delaware
    Posts
    494
    Vote Rating
    48
    Answers
    55
    Tim Toady has a spectacular aura about Tim Toady has a spectacular aura about Tim Toady has a spectacular aura about

      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