如何在 extjs 中动态创建选项卡?

How to create tabs dynamically in extjs?

我是 extjs 新手。我想根据从数据库生成的数字在我的面板中创建选项卡(考虑该值存储在 'numOfTabs' 中,它从数据库中获取并在 JS 中可用)。

我不想使用任何按钮事件来生成选项卡,但在页面加载本身时我需要查看选项卡。

如何在面板中创建 'n' 选项卡,其中 'n' 是 numOfTabs 中的值?

使用 extjs4.2.2

我从下面得到了答案link

http://docs.sencha.com/extjs/4.2.4/extjs-build/examples/tabs/tabs-adv.js

var tabPanel = Ext.getCmp('tabsID');
var items = tabPanel.items.items;
tabPanel.add({
    title: tTitle,
    id: tChieldID,
    closable: true,
    layout: 'fit',
    flex: 1,
    items: [{...}]
});
tabPanel.setActiveTab(tChieldID);