Ext.NET icon indicating copy to clipboard operation
Ext.NET copied to clipboard

TabCloseMenu: plug in no longer works as of Ext.NET 5

Open fabriciomurta opened this issue 4 years ago • 1 comments

Found: 5.3.0 Ext.NET Forums' thread: Plugin TabCloseMenu - closing the tab does not work

The plug in's functionality has stopped working, possibly between 4.x and 5.x upgrade as, per the override provided along the issue report, now the tab close method should be run over the individual tab panel's tab sub property.

The same applies to both Close Tab and Close Other Tabs options, as well as Close All Tabs. The change provided in the thread works as a work around for the Close Tab menu option.

The example for Ext.NET 5 is Tab Panel > Plugin > TabCloseMenu and no option from the plugin, to close tabs, works.

In the equivalent v4 example though, the plug in closes all tabs on Close Other Tabs and Close All Tabs, and closes none on Close Tab. So it's behavior in v4 is incomplete yet acts differently than v5's.

The support for this plugin is still not implemented for Ext.NET 7, so it only applies to Ext.NET 5.

This issue was first fixed in #1648.

fabriciomurta avatar Aug 04 '21 00:08 fabriciomurta

This should get further review but, at first, it fixes all plugin "close tab" alternatives:

Ext.define('gh1863', {
    override: 'Ext.ux.TabCloseMenu',

    // Calls 'closeTab()' instead of 'remove()'
    onClose: function () {
        this.tabPanel.closeTab(this.item.tab);
    },

    // Calls 'closeTab()' instead of 'remove()'
    doClose: function (excludeActive) {
        var items = [];

        this.tabPanel.items.each(function (item) {
            if (item.closable) {
                if (!excludeActive || item !== this.item) {
                    items.push(item.tab);
                }
            }
        }, this);

        Ext.suspendLayouts();
        Ext.Array.forEach(items, function (item) {
            this.tabPanel.closeTab(item);
        }, this);
        Ext.resumeLayouts(true);
    }
});

fabriciomurta avatar Aug 04 '21 00:08 fabriciomurta