如何使用extjs在Widget中实现Tab面板?

时间:2013-08-13 09:09:31

标签: javascript extjs tabs panel

我正在尝试在小部件中实现TAB-panel。

我可以看到它,但完全在错误的地方......这是VIEW的代码 我怎么能把它放在widget.TESTusersettings ????

我想renderTo:Ext.getBody()在这里不正确......你的意思是什么?

Ext.define("TEST.view.settings.UserSettings", {
    extend: "Ext.window.Window",
    alias: "widget.TESTdusersettings",

    requires: [
        "TEST.overrides.LocalComboBox",
        "TEST.common.LocaleManager",
        "Ext.form.Panel"
    ],

    width: 600,
    height: 300,
    border: false,
    closeAction: "hide",
    resizable: false,

    layout: "fit",

    title: 'User Settings',


    initComponent: function() {
        debugger;
        Ext.create('Ext.tab.Panel', {
            width: 300,
            height: 200,
            activeTab: 0,
            items: [
                {
                    title: 'Userdata',
                    bodyPadding: 10,
                    html: 'A simple tab'
                },
                {
                    title: 'Connections',
                    html: 'Connections one'
                },
                {
                    title: 'Payment',
                    html: 'Payment one'
                },
                {
                    title: 'Bills',
                    html: 'Bills one'
                }
            ],
            renderTo: Ext.getBody()
        });
    }

});

1 个答案:

答案 0 :(得分:2)

将init更改为此。

initComponent: function() {
    var me = this;
    Ext.applyIf(me, {
        items: Ext.create('Ext.tab.Panel', {
            activeTab: 0,
            items: [
                {
                    title: 'Userdata',
                    bodyPadding: 10,
                    html: 'A simple tab'
                },
                {
                    title: 'Connections',
                    html: 'Connections one'
                },
                {
                    title: 'Payment',
                    html: 'Payment one'
                },
                {
                    title: 'Bills',
                    html: 'Bills one'
                }
            ]
        })
    });

    me.callParent(arguments);
}