[CLOSED] Deactivate tab at runtime

  1. #1

    [CLOSED] Deactivate tab at runtime

    Hi,

    Is it possible to deactivate any tab from code behind which activated in tab panel? I mean one tab panel having 5 tabs and assume 3rd one activated. I want to make inactive (deactivate) that tab from code behind. If possible please provide small example.
    Last edited by Daniil; Nov 23, 2011 at 4:51 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Here you are.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Deactivate(object sender, DirectEventArgs e)
        {
            X.Call("deactivate", new JRawValue(this.TabPanel1.ClientID));
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    
        <script type="text/javascript">
            var deactivate = function (tb) {
                if (tb.activeTab) {
                    var oldEl = tb.getTabEl(tb.activeTab);
                    if (oldEl) {
                        Ext.fly(oldEl).removeClass('x-tab-strip-active');
                    }
                    tb.activeTab.hide();
                    tb.activeTab = null;
                }
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:TabPanel ID="TabPanel1" runat="server">
                <Items>
                    <ext:Panel runat="server" Title="Tab 1" Html="Tab 1" />
                    <ext:Panel runat="server" Title="Tab 2" Html="Tab 2" />
                </Items>
            </ext:TabPanel>
            <ext:Button runat="server" Text="Deactivate" OnDirectClick="Deactivate" />
        </form>
    </body>
    </html>
  3. #3
    Hi Daniil,

    Thank you this one is resolved my most of issues in my application.

    Quote Originally Posted by Daniil View Post
    Hi,

    Here you are.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Deactivate(object sender, DirectEventArgs e)
        {
            X.Call("deactivate", new JRawValue(this.TabPanel1.ClientID));
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    
        <script type="text/javascript">
            var deactivate = function (tb) {
                if (tb.activeTab) {
                    var oldEl = tb.getTabEl(tb.activeTab);
                    if (oldEl) {
                        Ext.fly(oldEl).removeClass('x-tab-strip-active');
                    }
                    tb.activeTab.hide();
                    tb.activeTab = null;
                }
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:TabPanel ID="TabPanel1" runat="server">
                <Items>
                    <ext:Panel runat="server" Title="Tab 1" Html="Tab 1" />
                    <ext:Panel runat="server" Title="Tab 2" Html="Tab 2" />
                </Items>
            </ext:TabPanel>
            <ext:Button runat="server" Text="Deactivate" OnDirectClick="Deactivate" />
        </form>
    </body>
    </html>
  4. #4
    Hi Daniil,

    This feature working fine but, the tab listener which make inactive is not working, means if deactivate any active tab and then click on that tab active listener to that tab is not working.

    Quote Originally Posted by rnachman View Post
    Hi Daniil,

    Thank you this one is resolved my most of issues in my application.
  5. #5
    Please add
    tb.layout.activeItem = null;
    Example
    var deactivate = function (tb) {
        if (tb.activeTab) {
            var oldEl = tb.getTabEl(tb.activeTab);
            if (oldEl) {
                Ext.fly(oldEl).removeClass('x-tab-strip-active');
            }
            tb.activeTab.hide();
            tb.activeTab = null;
            tb.layout.activeItem = null;
        }
    };
  6. #6
    Hi Daniil,

    Thank you now it is working.

    Quote Originally Posted by Daniil View Post
    Please add
    tb.layout.activeItem = null;
    Example
    var deactivate = function (tb) {
        if (tb.activeTab) {
            var oldEl = tb.getTabEl(tb.activeTab);
            if (oldEl) {
                Ext.fly(oldEl).removeClass('x-tab-strip-active');
            }
            tb.activeTab.hide();
            tb.activeTab = null;
            tb.layout.activeItem = null;
        }
    };

Similar Threads

  1. [CLOSED] StringFilter and DateFilter activate/deactivate
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jul 06, 2012, 3:58 PM
  2. Replies: 1
    Last Post: May 09, 2012, 7:08 PM
  3. [CLOSED] ComponentMenuItem: the best way to hide/deactivate?
    By capecod in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 05, 2010, 10:43 AM
  4. [CLOSED] Deactivate Rows in a CheckBoxSelectionModel
    By macap in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 19, 2010, 9:26 AM
  5. [CLOSED] Runtime adding Tab
    By methode in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 10, 2009, 3:38 PM

Tags for this Thread

Posting Permissions