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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,856
    Answers
    3968
    Vote Rating
    1322
      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
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    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
  •