0

我有一个这样的标签面板

Ext.application({
    name : 'Fiddle',

    launch : function() {

    Ext.create('Ext.TabPanel', {
    items: [
        {
            title: 'First Tab',
            id: 'firstTab'
            xclass: 'viewClass'

        },
        {
            title: 'Second Tab',
            xclass: ''
        }
    ]});}});

在 xclass 组件中有定义视图的类的路径。在视图中应该是一个按钮,点击它后,视图应该刷新并显示另一个类,例如视图应该由'viewClass2'定义,而不是由'viewClass'定义我正在成像按钮点击触发的功能像这样:

function(): {
    Ext.getCmp('firstTab').xclass = 'viewClass2';
    this.getView().refresh() // but it doesen't exist
}

我能做些什么来改变视图?

4

1 回答 1

2

您不能动态更改视图类型。

您只能删除视图并添加其他视图。

假设视图:

Ext.application({
    name : 'Fiddle',

    launch : function() {

        Ext.create('Ext.TabPanel', {
            id: 'tabId',
            items: [
                {
                    title: 'First Tab',
                    id: 'firstTab'
                    xclass: 'viewClass'
                }
            ]
        });
    }
});

并且某个按钮中的功能应该是:

a = function() {
    Ext.getCmp('tabId').remove(Ext.getCmp('firstTab'));
    Ext.getCmp('tabId').add({'xclass':'viewClass2'})
}
于 2019-05-16T16:51:47.103 回答