Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User netski's Avatar
    Join Date
    Oct 2008
    Posts
    50
    Vote Rating
    0
    netski is on a distinguished road

      0  

    Default [CLOSED][3.0rc3] Ext.extend and xtype problem?

    [CLOSED][3.0rc3] Ext.extend and xtype problem?


    Hello,

    I originally asked the question here but figured I would report it as well:

    The following example throws an exception:

    example.html
    Code:
    <html>
        <head>
            <link type="text/css" rel="stylesheet" href="lib/ext/resources/css/ext-all.css">
            
            <script type="text/javascript" src="lib/ext/build/adapter/ext-base.js"></script>
            <script type="text/javascript" src="lib/ext/ext-all-debug.js"></script>
    
            <script type="text/javascript">
                MyPanel = Ext.extend(Ext.Panel,
                {
                    tbar: {
                        xtype: 'toolbar',
                        items: {
                            text: 'Button 1'
                        }
                    }    
                } );
    
                Ext.onReady(function() {
                    new Ext.Viewport( {
                        layout: 'fit',
                        items: [
                            new MyPanel( {
                                html: 'Word'
                            } )
                        ]
                    } );
                } );
            </script>
        </head>
        <body>
            
        </body>
    </html>
    Work around noted by boylesw and lukman is the following:

    Code:
    MyPanel = Ext.extend(Ext.Panel, {
        initComponent: function() {
             Ext.apply(this, {
                  tbar: {
                       xtype: 'toolbar',
                       items: [{
                            text: 'Button 1'
                       }]
                   }
             });
     
             MyPanel.superclass.initComponent.apply(this, arguments);
        }
    });
    Should the first example not work?

    Cheers,
    Timothy

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,170
    Vote Rating
    674
    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


    Not a bug. Have a look at initComponent of Panel and you'll see why. Marking as closed.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext User netski's Avatar
    Join Date
    Oct 2008
    Posts
    50
    Vote Rating
    0
    netski is on a distinguished road

      0  

    Default


    Thanks evant will do.

    Cheers,
    Timothy

Thread Participants: 1