1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
    matthias-js is on a distinguished road

      0  

    Default Unanswered: CardPanel Cannot read property 'dom' of null

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,640
    Vote Rating
    898
    Answers
    3573
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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.

Thread Participants: 1

Tags for this Thread