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 User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    545
    Answers
    61
    Vote Rating
    97
    Tim Toady is a glorious beacon of light Tim Toady is a glorious beacon of light Tim Toady is a glorious beacon of light Tim Toady is a glorious beacon of light Tim Toady is a glorious beacon of light

      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.

Thread Participants: 1

Tags for this Thread