[CLOSED] TabCloseMenu Plugin.

  1. #1

    [CLOSED] TabCloseMenu Plugin.

    Guys

    Anyway I have a series of tabs which have the property "CloseAction=Hide" however if I close them using the TabCloseMenu plugin they seem to get destroyed as opposed to hidden.

    Is there a way to tell the TabCloseMenu plugin to respect that property or to override the default handler of the TabCloseMenu.

    Example of code that fails.

    
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Debug.aspx.cs" Inherits="Measures.Debug" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
    [DirectMethod]
    public void OpenTab(bool Tab1Open, bool Tab2Open)
    {
            if (Tab1Open == false)
    {
    this.TabPanel1.ShowTab(this.Tab1, true);
    this.Tab1.SetTitle("Tab 1");
    }
    
            else if (Tab2Open == false)
    {
    this.TabPanel1.ShowTab(this.Tab2, true);
    this.Tab2.SetTitle("Tab 2");
    }
    }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
    <title>Ext.NET v2 Example</title>
    </head>
    <body>
    <form id="Form2" runat="server">
    <ext:ResourceManager ID="ResourceManager2" runat="server" />
    
    <ext:Button ID="Button2"
    runat="server"
    Text="OpenTab"
    OnClientClick="App.direct.OpenTab(App.TabPanel1.contains(App.Tab1), App.TabPanel1.contains(App.Tab2));" />
    
    <ext:TabPanel ID="TabPanel1" runat="server">
    
                <Plugins>                    
                    <ext:TabCloseMenu ID="TabCloseMenu1" runat="server"  />
                </Plugins>  
    
    <Bin>
    <ext:Panel
    ID="Tab1"
    runat="server"
    Closable="true"
    CloseAction="Hide"
    Hidden="true" />
    
    <ext:Panel
    ID="Tab2"
    runat="server"
    Closable="true"
    CloseAction="Hide"
    Hidden="true" />
    </Bin>
    </ext:TabPanel>
    </form>
    </body>
    </html>
    Last edited by Daniil; Dec 12, 2013 at 6:20 AM. Reason: [CLOSED]
  2. #2
    Hi @CanopiusApplications,

    I think it is a defect. The TabCloseMenu should respect a tab's CloseAction setting.

    Please try this override:
    Ext.tab.TabCloseMenu.override({
        onClose : function() {
            this.tabPanel.closeTab(this.item); // instead of this.tabPanel.remove(this.item);
        },
    
        doClose : function(excludeActive){
            var items = [];
    
            this.tabPanel.items.each(function(item){
                if(item.closable){
                    if(!excludeActive || item != this.item){
                        items.push(item);
                    }
                }
            }, this);
    
            Ext.each(items, function(item){
                this.tabPanel.closeTab(item); // instead of this.tabPanel.remove(item);
            }, this);
        }
    });
  3. #3
    Perfect thanks Danil.

    D
  4. #4
    Committed to the SVN trunk in the revision #5555.

    Thank you again for the report!

Similar Threads

  1. In EXT 'TabCloseMenu' what is in MVC ?
    By vikram in forum 2.x Help
    Replies: 0
    Last Post: Sep 11, 2013, 9:27 AM
  2. Replies: 4
    Last Post: Nov 23, 2012, 6:36 PM
  3. Problems with ext: TabCloseMenu
    By billy in forum 2.x Help
    Replies: 2
    Last Post: Oct 16, 2012, 10:38 PM
  4. [CLOSED] TabCloseMenu plugin firing close event
    By Justin_Wignall in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 28, 2010, 12:18 PM

Tags for this Thread

Posting Permissions