【问题标题】:How to get a tabpanel inside a viewport with the ExtJS 4 class model?如何使用 ExtJS 4 类模型在视口中获取选项卡面板?
【发布时间】:2011-08-11 09:41:57
【问题描述】:

我遇到了 extjs 4 类模型的问题。我想在视口中获得一个标签面板。我通过定义自己的元素并使用 xcode 自动加载它来运行它。但我没有在父类本身内完成它。

Ext.define('MyApp.views.TheWindow', {
    extend  : 'Ext.Viewport',
    requires: [],
    border  : false,
    layout  : {
        type    : 'fit'
    },
    initComponent : function() {
        this.items  = this.buildItems();
        this.callParent();
    },
    buildItems : function() {
        return [
            {
                extend: 'Ext.TabPanel',
                activeTab: 0,
                alias: 'widget.MyTapPanel',
                items: [
                    {

                        title: 'Artikel Manager',
                        html: 'test' 
                        /*items: [
                            {
                            }
                        ]*/
                    },
                    {
                        title: 'Artikel Manager',
                        html: 'test' 
                        /*items: [
                            {
                            }
                        ]*/
                    }
                ]
            }

        ];
    }
});

我的代码有什么问题?

【问题讨论】:

    标签: extjs extjs4 tabpanel extjs-mvc


    【解决方案1】:

    替换

    extend: 'Ext.TabPanel',
    

    xtype: "tabpanel"
    

    而且你不需要定义别名,因为你没有定义新的类(Ext.define),你只是定义了项目配置。

    【讨论】:

    • 天哪。在尝试了一整天之后,我让它运行起来了。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多