1. #1
    Ext User
    Join Date
    Sep 2007
    Posts
    64
    Vote Rating
    0
    bluesapphire is on a distinguished road

      0  

    Question How to Automatically Close 'Alert' after sometime

    How to Automatically Close 'Alert' after sometime


    Hi!
    How can an 'Alert' messagebox be closed after specific time, without clicking on 'OK' button.

    Thanks in advance

  2. #2
    Ext User Blackhand's Avatar
    Join Date
    May 2008
    Posts
    42
    Vote Rating
    0
    Blackhand is on a distinguished road

      0  

    Default


    This completely untested =), but you could try something like this.

    Code:
    var alertWindow = Ext.Msg.alert('Alert', 'An alert!');
    
    (function() {
       alertWindow.hide();
    }).defer(10000);

  3. #3
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,169
    Vote Rating
    28
    jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough

      0  

    Default


    Quote Originally Posted by Blackhand View Post

    Code:
    Ext.MessageBox.alert('Alert', 'An alert!');
    
    (function() {
       Ext.MessageBox.hide();
    }).defer(10000);
    Modified to work

    Ext.MessageBox is a singleton, thus a ref is not necessary.

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.

  4. #4
    Ext User Blackhand's Avatar
    Join Date
    May 2008
    Posts
    42
    Vote Rating
    0
    Blackhand is on a distinguished road

      0  

    Default


    Thanks jgarcia, and yes you are correct, a reference is not needed.

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Posts
    210
    Vote Rating
    0
    KRavEN is on a distinguished road

      0  

    Default


    Shorter Ext.MessageBox.hide.defer(1500,this); also works

  6. #6
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,169
    Vote Rating
    28
    jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough

      0  

    Default


    Quote Originally Posted by KRavEN View Post
    Shorter Ext.MessageBox.hide.defer(1500,this); also works
    you sure you want the hide method to execute within the scope of window or whatever Object this references?

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.