开发者

Dynamically add items to TabBar in Sencha Touch

开发者 https://www.devze.com 2023-04-08 05:42 出处:网络
New to senchatouch world, trying to make the following code work. I have the following code : myApp.views.Homecard = Ext.extend(Ext.TabPanel, {

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.Homec开发者_C百科ard.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 ?


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];

0

精彩评论

暂无评论...
验证码 换一张
取 消