将组件添加到ExtJS中的选项卡式窗格

时间:2014-05-22 12:25:01

标签: javascript extjs

我想在 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。

1 个答案:

答案 0 :(得分:0)

网格是面板的子类,因此它直接位于选项卡下:

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