1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    36
    Vote Rating
    0
    user14 is on a distinguished road

      0  

    Default What's wrong with this simple 2 line code?

    What's wrong with this simple 2 line code?


    I just simply want create my class , which is the same like MessageBox:

    Ext.define('com.rom.MB', {
    extend : 'Ext.window.MessageBox'
    });

     

    create "instance" of that class:
    var r= Ext.create('com.rom.MB');

    call "inherited" method:
    r.show();

    browser complains :
    Uncaught TypeError: Cannot read property 'buttons' of undefined

    I think all methods/properties should be inherited ???

  2. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    It seems that you are using Ext 4.0. It's not the problem of inherit. It's a bug in assuming that you call the show() method with an config object. In case you don't pass a config object, it will cause error of using null object. Let have a look at source code of Ext.window.Message box and you will see.
    Code:
        reconfigure: function(cfg) {
            var me = this,
                buttons = cfg.buttons || 0, // <- this line cause error
                hideToolbar = true,
                initialWidth = me.maxWidth,
                i;
    To fix this error, you should call show() method with an config object, at least with empty object

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    36
    Vote Rating
    0
    user14 is on a distinguished road

      0  

    Default


    what is syntax to "call show with config object" please?

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,828
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha User
    Join Date
    Sep 2011
    Posts
    36
    Vote Rating
    0
    user14 is on a distinguished road

      0  

    Default


    Pleaseeeeee , small/micro syntax example , pleaseee !

  6. #6
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,828
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    As I said, there's an example right there where I linked you, please take the time to actually read the responses!

    Code:
    Ext.Msg.show({
        title: 'Address',
        msg: 'Please enter your address:',
        width: 300,
        buttons: Ext.Msg.OKCANCEL,
        multiline: true,
        fn: saveAddress,
        animateTarget: 'addAddressBtn',
        icon: Ext.window.MessageBox.INFO
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  7. #7
    Sencha User
    Join Date
    Sep 2011
    Posts
    36
    Vote Rating
    0
    user14 is on a distinguished road

      0  

    Default


    The same way like I'd have it done in Java:

    class ComRomMB extends ExtWindowMessageBox{ }
    ComRomMB comRomMb= new ComRomMB();
    comRomMB.show();

    And here is Ext code:

    Ext.define('com.rom.MB', {
    extend : 'Ext.window.MessageBox'
    });

    var r= Ext.create('com.rom.MB');

    r.show({
    title: 'My Title',
    msg: 'My Message',
    width: 300,
    buttons: Ext.Msg.OKCANCEL
    });

    It's weird a bit, because simply r.show() is not working

  8. #8
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    The following code works well for me on Chrome 18 with both Ext 4.0.7 and Ext 4.1.0:
    Code:
    Ext.onReady(function(){
        Ext.define('com.rom.MB', {
            extend : 'Ext.window.MessageBox'
        });
    
    
        var r= Ext.create('com.rom.MB');
    
    
        r.show({
            title: 'My Title',
            msg: 'My Message',
            width: 300,
            buttons: Ext.Msg.OKCANCEL
        });
    
    
    });

  9. #9
    Sencha User
    Join Date
    Sep 2011
    Posts
    36
    Vote Rating
    0
    user14 is on a distinguished road

      0  

    Default


    Yes, code is working, but for me SYNTAX is a bit unusual

Thread Participants: 2

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