1
Senchatouch世界的新手,試圖使下面的代碼工作。在Sencha Touch中動態添加項目到TabBar
我有以下代碼:
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);
,我想添加一個新項目:
myApp.views.Homecard.add({html: 'test'});
但我發現了以下錯誤:
Uncaught TypeError: Object function(){h.apply(this,arguments)}
has no method 'add'
我錯過了什麼?
Somet like Ext.getCmp('myownid')。add(myitem); ?你能提供一個例子嗎? – Disco
你是對的。 'Ext.getCmp('myownid')。add({html:'test'});'應該工作。 – ilija139