Adding 2 idetical tabs on the same TabPanel

  1. #1

    Adding 2 idetical tabs on the same TabPanel

    Hi,
    How can i add 2 identical tabs (same title,id) on the same Tab Panel if it is possible?
    This one adds only once., not adding twice. Purpose of this thread is to open same pages twice or more and easily compare reports generated by different parameters.

    <ext:Button ID="Button1" runat="server" Text="Add new tab" OnDirectClick="TestDirectEventHandler" />
    <script runat="server">
        protected void TestDirectEventHandler(object sender, DirectEventArgs e)
        {       
            
            var t = new Ext.Net.Panel()
            {
                
                Title = "New tab",
                ID = "NewTabID",
                Html = "Tab1's content",
                Closable = true
            };
            t.AddTo(this.TabPanel1);
            this.TabPanel1.SetActiveTab(t.ClientID);
           
        }
    </script>
  2. #2
    ID must be unique for each widget. What is purpose to have the same id for several tabs?
  3. #3
    I just want to open the same page on different tabs. For example, i have menu item like this
    <ext:MenuItem ID="MenuItem3" runat="server" Text="Page 3" Icon="ArrowRight">
             <Listeners>
             <Click Handler="addTab(#{TabPanel1}, 'idP3', 'Page_3.aspx','Page 3');" />
               </Listeners>
                </ext:MenuItem>
    when i click it, this one adds it on Tabpanel1.
     <script type="text/javascript">
            var addTab = function (tabPanel, id, url,text) {
    
                var tab = tabPanel.getComponent(id);
    
                if (!tab) {
                    tab = tabPanel.add({
                        id: id,
                        title: text,
                        closable: true,
                        autoLoad: {
                            showMask: true,
                            url: url,
                            mode: "iframe",
                            maskMsg: "Loading " + url + "..."
                        }
                    });
    
                    tab.on("activate", function () {
                        var item = MenuPanel1.menu.items.get(id + "_item");
    
                        if (item) {
                            MenuPanel1.setSelection(item);
                        }
                    }, this);
                }
    
                tabPanel.setActiveTab(tab);
            }
        </script>
    On the TabPanel1, i added a button to open the selected menuitem (active tab).
    <ext:TabPanel ID="TabPanel1" runat="server" Region="Center" >
                
      <Buttons >
        <ext:Button  ID="Button1" runat="server" Text="Add new tab" OnDirectClick="TestDirectEventHandler" />
         </Buttons>
    
        </ext:TabPanel>
    How can i modify this code to open the active tab (or selected menuitem)?
      <script runat="server">
        protected void TestDirectEventHandler(object sender, DirectEventArgs e)
        {
           
            
            var t = new Ext.Net.Panel()
            {
                
                Title = "New tab",
                ID = "NewTabID",
                Html = "Tab1's content",
                Closable = true
            };
            t.AddTo(this.TabPanel1);
            this.TabPanel1.SetActiveTab(t.ClientID);
    
           
        }
    </script>
  4. #4
    Well, opening the same page in several tabs doesn't assume that tabs must have the same id.
    Just different id for tabs (or don't set id at all)
  5. #5
    ok. I dont set id it at all. But, I can you help me to get the "url and title of active tab" on OnDirectClick?
    
    <ext:Button  ID="Button1" runat="server" Text="Add new tab" OnDirectClick="TestDirectEventHandler" />
     <script runat="server">
        protected void TestDirectEventHandler(object sender, DirectEventArgs e)
        {
            
             
            var t = new Ext.Net.Panel()
            {
                 
                Title = actibetab title????,
                 autoLoad: {
                            showMask: true,
                            url: activetab url???,
                            mode: "iframe",
                            maskMsg: "Loading " + url + "..."
                        }
               
                Closable = true
            };
            t.AddTo(this.TabPanel1);
            this.TabPanel1.SetActiveTab(t.ClientID);
     
            
        }
    </script>
  6. #6
    Quote Originally Posted by ozayExt View Post
    ok. I dont set id it at all. But, I can you help me to get the "url and title of active tab" on OnDirectClick?
    You can pass the values to the server-side DirectEvent handler, but using the <ExtraParams> configuration.
    Geoffrey McGill
    Founder

Similar Threads

  1. Adding Tabs With OnActivate Listener
    By juan_pablo in forum 1.x Help
    Replies: 4
    Last Post: Apr 25, 2010, 3:28 PM
  2. adding tabs dynamically
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 3
    Last Post: Nov 16, 2009, 7:29 AM
  3. Replies: 1
    Last Post: Mar 26, 2009, 8:54 AM
  4. Adding tabs to tabpanel in JavaScript
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 0
    Last Post: Dec 04, 2008, 9:20 AM
  5. Adding textfields to tabs
    By sz_146 in forum 1.x Help
    Replies: 0
    Last Post: Nov 13, 2008, 10:35 AM

Posting Permissions