can we add tab from content page to parent page.

  1. #1

    can we add tab from content page to parent page.


    Hi,

    I have menu panel just similar to 'coolite example explorer'.When i click on one menu item
    related page opening in center portion of main page.
    Now i have new page opened in main page,that new page has button when i click on button i need to open a new tab in my main page(not from menu links).

    Can you please guide me how can i achive this.

    Thanks and Regards,
    Satya
  2. #2

    RE: can we add tab from content page to parent page.

    Hi,

    You can call js functions from parent page
    parent.addTab(...);
  3. #3

    RE: can we add tab from content page to parent page.

    Hi vladimir,

    from parent page i can able to create new tabs.when i need to create tab on parent page(add tab to existing tab panel) when i click on button on child page.

    if you have any sample code plz send me.

    Thanks and regards
    Satya
  4. #4

    RE: can we add tab from content page to parent page.

    Hi,

    Yes, you can create tab on the parent page from child page

    1. Define 'addTab' in the parent page for tabs adding
    2. Call in the child page
    parent.addTab(...);
  5. #5

    RE: can we add tab from content page to parent page.

    Hi,

    Thanks for the quick reply..

    i tried to call like from child page..


    <Click Handler="parent.taddTab(#{TabPanel1}, 'idGgl', 'http://www.google.com');" />

    and my JS function in child page like ..




    function taddTab(tabPanel, id, url) {


    alert(tabPanel);


    .......
    }

    here tabPanel object is going to null value...





  6. #6

    RE: can we add tab from content page to parent page.

    Hi,

    taddTab function must be on parent page

    Please see the sample


    Parent page
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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></title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
        
         <script type="text/javascript">
            var addTab = function (tabPanel, id, url) {
                tabPanel = tabPanel || TabPanel1;
                var tab = tabPanel.getComponent(id);
    
                if (!tab) {
                    tab = tabPanel.add({ 
                        id       : id, 
                        title    : url, 
                        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>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
            <ext:Window runat="server" Width="700" Height="500" Icon="Link" Title="Adding tab">
                <Items>
                    <ext:BorderLayout runat="server">
                        <West>
                            <ext:MenuPanel ID="MenuPanel1" runat="server" Width="200">
                                <Menu runat="server">
                                    <Items>
                                        <ext:MenuItem ID="idPage_item" runat="server" Text="Page">
                                            <Listeners>
                                                <Click Handler="addTab(#{TabPanel1}, 'idPage', 'Basic.aspx');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                    </Items>
                                </Menu>
                            </ext:MenuPanel>
                        </West>
                        <Center>
                            <ext:TabPanel ID="TabPanel1" runat="server" />                               
                        </Center>
                    </ext:BorderLayout>
                </Items>
            </ext:Window>
        </form>
    </body>
    </html>
    Child page
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!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 id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server"  />
            
            <ext:Button runat="server" Text="Add tab">
                <Listeners>
                    <Click Handler="parent.addTab(null, 'idChild1', 'Basic.aspx');" />
                </Listeners>
            </ext:Button>
            
            <ext:Button runat="server" Text="Anoter Add tab">
                <Listeners>
                    <Click Handler="parent.addTab(parent.TabPanel1, 'idChild2', 'Basic.aspx');" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
  7. #7

    RE: can we add tab from content page to parent page.


    Thank you very much..Vladimir ,

    It is working fine..the example which you give really very usefull for me.

    Thanks again..

    Satya

Similar Threads

  1. [CLOSED] How to show ext:Window on Parent page in Nested page
    By ViDom in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 09, 2012, 2:33 PM
  2. Replies: 1
    Last Post: Feb 03, 2012, 2:36 PM
  3. [CLOSED] Child page to parent page call
    By majestic in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 05, 2010, 5:41 PM
  4. Replies: 2
    Last Post: May 05, 2010, 10:23 AM
  5. Replies: 5
    Last Post: Aug 04, 2009, 10:49 AM

Posting Permissions