Results 1 to 2 of 2

Thread: CardPanel Cannot read property 'dom' of null

  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
      0  

    Default CardPanel Cannot read property 'dom' of null

    Hi all,

    I'm new to Ext-js and here is my question. I want to switch the items inside the card panel, but all I get is 'Cannot read property 'dom' of null'. I can not figure out what I'm doing wrong.

    Kind regards
    Matthias

    Code:
    Ext.define('TestApp.view.ContentPanel', {
        extend:'Ext.Panel',
        alias:'widget.contentpanel',
        id:'content-panel',
        region:'center',
        layout:'card',
        activeItem:0,
        border:false,
        items:[
            { html: '<h1>Card 1</h1>' },
            { html: '<h1>Card 2</h1>' }
        ]
    });
    
    
    
    
    Ext.application({
        name:'TestApp',
        autoCreateViewport:true,
        launch:function () {
            Ext.widget('contentpanel').getLayout().setActiveItem(1);
        }
    });
    
    
    Ext.define('TestApp.view.Viewport', {
        extend: 'Ext.container.Viewport',
        layout: 'fit',
        initComponent: function() {
            this.items = [Ext.widget('contentpanel')];
            this.callParent();
        }
    });

  2. #2
    Sencha - Community Support Team mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,023
    Answers
    3976
    Vote Rating
    1364
      0  

    Default

    Ext.widget will create a new instance, you are creating your viewport which you need to resolve the contentpanel and set the activeItem on it.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •