如何将 extjs 仪表板重置为其默认布局

how to reset an extjs dashboard to its default layout

如何将仪表板重置为其原始“形状”?

我有这个 fiddle,其中仪表板有 7 个面板中的 6 个 可关闭的(并将在关闭时销毁)。

当用户点击重置按钮时,它应该恢复所有面板。

唯一的办法就是全部删除再重新添加。像这样:

    onResetClick: function () {
        const me = this;
        let newContent = [
            {type: "toppanel", columnIndex: 0},
            {type: "midpanel1", columnIndex: 1},
            {type: "midpanel2", columnIndex: 2},
            {type: "midpanel3", columnIndex: 3},
            {type: "bottompanel1", columnIndex: 1},
            {type: "bottompanel2", columnIndex: 2},
            {type: "bottompanel3",columnIndex: 3}
        ];
        
        me.removeAll();

        newContent.forEach(function(widget) {
            const columnIndex = widget.columnIndex;
            delete widget.columnIndex;
            
            me.addView(widget, columnIndex);
        });
    }