Threaded View

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Vote Rating
    eddyystop is on a distinguished road


    Default Answered: Why doesn't 'Ext.Msg.alert(...)' work while 'Ext.Msg.prompt()' does?

    Answered: Why doesn't 'Ext.Msg.alert(...)' work while 'Ext.Msg.prompt()' does?

    I'm just starting with Ext JS and trying to understand the why's of the following using Ext4.

    These work:
    Ext.Msg.prompt('...', '...', fn);{...});

    But this doesn't work in the latest Chrome and FF:
    Ext.Msg.alert('...', '...', fn);
    Chrome gives the console msg: Cannot call method 'alert' of undefined.

    So I'm using:
    Ext.create('Ext.window.MessageBox').alert('...', '...', fn);

  2. Thank you Chamacs.
    The following is my new noobie understanding. I'm most uncertain about the very last paragraph. Please correct me if I'm wrong. Thanks.

    I can use
    Ext.Msg.alert('...', '...', fn);

    (a) with the brute-force way using
    <script type="text/javascript" src="../../extjs/ext-all-debug.js"></script>
    or ext-all-dev.js or ext-all.js

    (b) with dynamic loading using
    <script type="text/javascript" src="../../extjs/ext-dev.js"></script>
    or ext-debug.js or ext.js
    <script type="text/javascript">
    // A leading script tag is used to ensure this is all loaded before
    // the following script starts executing.
        enabled        : true,
        disableCaching : false,
        paths          : {
            // relative path where to find '' thingies
            'Ext' : '../../extjs/src'
    // Do asynchronous loading of classes we know we'll need
    <script type="text/javascript">
    Ext.onReady(function () {
    // Following gives: TypeError: Obj fcn () {...} has no method alert
    // because 'Ext.window.MessageBox' is a class, while
    // 'Ext.MessageBox' is a singleton instance of it, while
    // 'Ext.Msg' is a convenience alternate name for 'Ext.MessageBox'
    //    Ext.window.MessageBox.alert('Hello.', 'The DOM is ready');
    // Following also work   
    //    Ext.Msg.alert('Hello.', 'The DOM is ready');
    //    Ext.MessageBox.alert('Hello.', 'The DOM is ready');
    // If Ext.require does not exist above, this synchronously loads the class on demand
    // If Ext.require exists above, Ext.Loader knows class is loaded already
        var win = Ext.create('Ext.window.MessageBox');
        win.alert('Hello.', 'The DOM is ready!'); 
    My main uncertainty: Ext.window.MessageBox is a class (implemented as a function) and so you cannot use .alert on it. Ext.MessageBox and Ext.Msg are the same singleton instance (implemented as an object) of the class (via 'new') and so .alert can be called on them.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi