[CLOSED] TabPanel and Closable

  1. #1

    [CLOSED] TabPanel and Closable

    Hello,

    The following examples fails:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
        protected void Tab2_Close(object sender, AjaxEventArgs e)
        {
            lblResult.Text = "Tab2 closed, hurray!";
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Example</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager runat="server" EnablePartialRendering="True" />
        <ext:ScriptManager runat="server" ScriptMode="Debug" />
            <ext:TabPanel runat="server">
                <Tabs>
                    <ext:Tab ID="Tab1" runat="server" Title="Content 1">
                        <Content>
                            Content 1
                        </Content>
                    </ext:Tab>
                    <ext:Tab ID="Tab2" runat="server" Closable="True" Title="Content 2">
                        <Content>
                            Content 2
                        </Content>
                        <AjaxEvents>
                            <Close OnEvent="Tab2_Close" />
                        </AjaxEvents>
                    </ext:Tab>
                </Tabs>
            </ext:TabPanel>
            <ext:Label ID="lblResult" runat="server" Text="Waiting ..." />
        </form>
    </body>
    </html>
    Replication steps:

    1. Load page
    2. Click "X" on Tab 2
    3. Notice it closes, no AjaxEvent called

    Cheers,
    Timothy
  2. #2

    RE: [CLOSED] TabPanel and Closable

    Hi Timothy,

    The Tabs don't support directly Close event (it is ExtJS original behaivor) . I can sugest next solution for you:
    
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
        protected void Tab2_Close(object sender, AjaxEventArgs e)
        {
            lblResult.Text = "Tab2 closed, hurray!";
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Example</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
        <ext:ScriptManager ID="ScriptManager2" runat="server" ScriptMode="Debug" />
            <ext:TabPanel ID="TabPanel1" runat="server">
                <Tabs>
                    <ext:Tab ID="Tab1" runat="server" Title="Content 1" Closable="True">
                        <Content>
                            Content 1
                        </Content>
                    </ext:Tab>
                    <ext:Tab ID="Tab2" runat="server" Closable="True" Title="Content 2">
                        <Content>
                            Content 2
                        </Content>                   
                    </ext:Tab>
                </Tabs>
                <AjaxEvents>
                    <BeforeRemove OnEvent="Tab2_Close" Before="return params[1].id == #{Tab2}.id;"></BeforeRemove>
                </AjaxEvents>
            </ext:TabPanel>
            <ext:Label ID="lblResult" runat="server" Text="Waiting ..." />
        </form>
    </body>
    </html>
    As you can see I handle BeforeRemove event of TabPanel and check what component (params[1]) was closed
    Last edited by geoffrey.mcgill; Oct 15, 2010 at 6:01 PM.
    Vladimir Shcheglov
    Sr. Developer
  3. #3

    RE: [CLOSED] TabPanel and Closable

    Awesome vlad, would be a nice addition, but great suggestion! :)

    Cheers,
    Timothy

Similar Threads

  1. [CLOSED] Closable Autohide Notification
    By SouthDeveloper in forum 1.x Premium Help
    Replies: 2
    Last Post: Jul 22, 2011, 11:25 AM
  2. [CLOSED] Closable TabPanel are unable to show once closed.
    By rnachman in forum 1.x Premium Help
    Replies: 11
    Last Post: Apr 14, 2011, 7:55 PM
  3. Replies: 2
    Last Post: Apr 23, 2010, 9:02 AM
  4. Replies: 1
    Last Post: Apr 01, 2010, 4:27 PM
  5. Replies: 2
    Last Post: Feb 03, 2009, 5:56 PM

Posting Permissions