在ExtJS中向选项卡窗格添加组件

Adding component to tabbed pane in ExtJS

本文关键字:添加 组件 选项 ExtJS      更新时间:2023-09-26

我试图在ExtJS中做一点概念证明。我想添加一个面板与树到我的选项卡之一,但我似乎无法在API中找到答案。

示例如下

var tabs = Ext.create('Ext.tab.Panel', {
    items: [
        {
            title: 'Tab 1',
            html : 'A simple tab'
        },
        {
            title: 'Tab 2',
            html : 'Another one'
        }
    ],
    renderTo : Ext.getBody()        
});

但是我想要这样的东西:

   var treegrid = Ext.create('KitchenSink.view.tree.TreeGrid', {....});

    var tabs = Ext.create('Ext.tab.Panel', {
        items: [
            {
                title: 'Tab 1',
                html : 'A simple tab'
            },
            {
                title: 'Tab 2',
                myComponent : treegrid
            }
        ],
        renderTo : Ext.getBody()        
    });

我想知道我应该把myComponent。显然myComponent是不正确的。

抱歉,如果这个问题看起来真的很幼稚。我非常 ExtJS新手

grid是panel的一个子类,所以它直接放在标签下面:

new Ext.tab.Panel({
    items: [{
        title: 'My Grid',
        xtype: 'gridpanel',
        columns: [],
        // Other grid stuff
    }]
});