[CLOSED] [0.8.2] Adding new Tab from Tab into a TabPanel problem

  1. #1

    [CLOSED] [0.8.2] Adding new Tab from Tab into a TabPanel problem

    Hi!

    Today I got another problem.

    As you can see in this thread title, I need add a tab from another tab into a tabpanel. I load "Inicio" tab with AutoLoad.
    Look at this code.

    Default.aspx
    ----------------
    <!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>
        <script type="text/javascript">
    function addTab(tabPanel, id, titulo, url) {
        var tab = tabPanel.getComponent(id);
        if (!tab) {
            tab = tabPanel.add({
                id: id,
                title: titulo,
                closable: true,
                autoLoad: {
                    showMask: true,
                    url: url,
                    mode: 'iframe',
                    maskMsg: 'Cargando ' + titulo + '...'
                }
            });
            tabPanel.setActiveTab(tab);
        }
    
        else {
            tabPanel.setActiveTab(tab);
            tab.reload(true);
        }
    
    }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="SM" runat="server" />
        <ext:ScriptManager ID="cSM" runat="server" Style="display: none" />
        <ext:ViewPort ID="ViewPort1" runat="server">
            <Body>
                <ext:BorderLayout ID="BorderLayout1" runat="server">
                    <North>
                    </North>
                    <West>
                    </West>
                    <Center>
                        <ext:TabPanel ID="TabPanel1" runat="server" EnableTabScroll="True" Title="TabPanel1">
                            <Tabs>
                                <ext:Tab ID="Inicio" Icon="HouseStar" Title="Inicio">
                                    <AutoLoad Url="Inicio.aspx" Mode="IFrame" MaskMsg="Cargando Página de Inicio..." ShowMask="true">
                                    </AutoLoad>
                                </ext:Tab>
                            </Tabs>
                            <Plugins>
                                <ext:TabCloseMenu ID="TabCloseMenu1" runat="server" CloseOtherTabsText="Cerrar las demás pestañas" CloseOtherTabsIcon="ApplicationCascade"  CloseTabText="Cerrar esta pestaña" CloseTabIcon="Application" />
                            </Plugins>
                        </ext:TabPanel>
                    </Center>
                </ext:BorderLayout>
            </Body>
        </ext:ViewPort>
        </form>
    </body>
    </html>
    Inicio.aspx
    -------------
    <%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Ciber/recursos/masters/SiteBase.Master" CodeBehind="Inicio.aspx.vb" Inherits="intranetsCiber.Inicio" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderCentro" runat="server">
    <div>
    <asp:Panel ID="NuevoPedido" runat="server" >
            <li>
                <ext:LinkButton ID="NuevoPedidoLink" runat="server" Flat="true" Text="Nuevo Pedido" >
                    <Listeners>
                       <Click Handler="top.addTab(#{TabPanel1}, 'Nuevo Pedido', 'Nuevo Pedido', 'compras/comprasForm.aspx');"/>
                    </Listeners>
                </ext:LinkButton>
            </li>
    </asp:Panel>
    </div>
    </asp:Content>
    SiteBase.Master
    ------------
    <!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>
         <asp:ContentPlaceHolder ID="head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body>
        <form id="form1" runat="server" enctype="multipart/form-data" method="post">
        <asp:ScriptManager ID="SM" runat="server" />
        <ext:ScriptManager ID="cSM" runat="server" Style="display: none" AjaxMethodNamespace="Metodos" CleanResourceUrl="false">
        </ext:ScriptManager>
        <asp:ContentPlaceHolder ID="ContentPlaceHolderCentro" runat="server">
        </asp:ContentPlaceHolder>
        <br/>
        <asp:Label ID="LabelDebug" runat="server" ForeColor="Red"></asp:Label>
        </form>
    </body>
    </html>
    After click In NuevoPedidoLink firebug shows that:
    tabPanel is null
    var tab = tabPanel.getComponent(id);
    I'm getting crazy with that, help please!

    Waiting for your reply,



    FVNoel
    Last edited by Daniil; Oct 22, 2010 at 7:24 AM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi,

    Please use
    parent.TabPanel1
    instead of
    #{TabPanel1}
    The TabPanel1 is placed on another page therefore #{TabPanel1} is null.
  3. #3
    Thank you Dan, It works fine. :)

Similar Threads

  1. [CLOSED] Adding a New Tab to TabPanel
    By ndotis in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Jun 30, 2012, 6:38 AM
  2. [CLOSED] ext:TabPanel: adding controls in JavaScript.
    By supera in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 26, 2012, 4:44 PM
  3. Adding 2 idetical tabs on the same TabPanel
    By ozayExt in forum 1.x Help
    Replies: 5
    Last Post: Aug 22, 2011, 5:12 PM
  4. Problems adding tab to tabpanel
    By xxjt123xx in forum 1.x Help
    Replies: 0
    Last Post: Mar 02, 2011, 10:55 PM
  5. TabPanel error on adding tab
    By sz_146 in forum 1.x Help
    Replies: 0
    Last Post: Jan 09, 2009, 9:01 AM

Posting Permissions