Disco
Disco

Reputation: 4406

Dynamically add items to TabBar in Sencha Touch

New to senchatouch world, trying to make the following code work.

I have the following code :

myApp.views.Homecard = Ext.extend(Ext.TabPanel, {
    id: 'myownid',
    title : "home",
    iconCls : "home",
    defaults : {
        styleHtmlContent : true
    },
    items : [{
        title : 'Item1',
        scroll : 'vertical',
        iconCls : 'home',
        html : 'Some Content'
    }, {
        title : 'Item2',
        scroll : false,
        iconCls : 'home',
        html : 'Some Content'
    }],
});

Ext.reg('homecard', myApp.views.Homecard);

And i'd like to add a new item :

myApp.views.Homecard.add({html: 'test'});

But i'm getting the following error :

Uncaught TypeError: Object function (){h.apply(this,arguments)}
has no method 'add'

What am I missing ?

Upvotes: 1

Views: 1376

Answers (1)

ilija139
ilija139

Reputation: 2974

You can't access the TabPanel like that. Either add an id property and then get it with Ext.getCmp(theId); or get it like item of it's parent, example parent.items.items[0];

Upvotes: 2

Related Questions