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 Unanswered: 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,326
    Answers
    3884
    Vote Rating
    1297
      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!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

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
  •