[CLOSED] Close Button not working if window closed and reopen from another window

  1. #1

    [CLOSED] Close Button not working if window closed and reopen from another window

    Hi,

    In my web application I need one scenario like... from main form I need to open one popup (test1) and then from popup (test1) I need to open another popup (test2), but it should open below test1 popup. So I did something like... while open test2 from test1, hiding test1 and after load test2 showing the test1. So test1 is showing on top of test2. If I close test1 window, test2 is not closing.

    Can you please let me know if any property is there to open popup window at top of all windows? if not please check what changes I need to do to work?

    Master form...
    
    <%@ 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">
    <script runat="server">
    
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script language="javascript" type="text/javascript">
            var renderWindow = function (windowConfig) {
                var win = Ext.getCmp(windowConfig.id);
                if (!win) {
                    new Ext.Window(windowConfig);
                } else {
                    win.close();
                    new Ext.Window(windowConfig);
                }
            }
    
            var ShowTestWindow = function () {
                //alert(appid);
                var windowConfig = {
                    id: "WinTest",
                    height: 150,
                    width: 450,
                    hidden: false,
                    closeAction: "hide",
                    buttonAlign: "center",
                    title: "Upload Test",
                    iconCls: "icon-pagewhitecode",
                    buttons: [
                        {
                            id: "btnSendClose",
                            text: "Close",
                            listeners: {
                                click: {
                                    fn: function (el, e) {
                                        Ext.getCmp('WinTest').hide();
                                    }
                                }
                            }
                        }
                    ],
                    autoLoad: {
                        url: "ExtTest1.aspx?" + new Date().getTime(),
                        nocache: true,
                        mode: "iframe",
                        showMask: true,
                        triggerEvent: "show",
                        reloadOnEvent: true
                    }
                }
                renderWindow(windowConfig);
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Viewport ID="Viewport1" runat="server" Layout="Border">
            <Items>
                <ext:Button ID="btnOpen" runat="server" Text="OpenWindow">
                    <Listeners>
                        <Click Handler="ShowTestWindow()" />
                    </Listeners>
                </ext:Button>
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
    Test1 window...

    <%@ 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">
    
    <script runat="server">
    
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script language="javascript" type="text/javascript">
            var ShowTestWindow = function () {
                //alert(appid);
                var windowConfig = {
                    id: "WinTest2",
                    height: 180,
                    width: 500,
                    hidden: false,
                    closeAction: "hide",
                    buttonAlign: "center",
                    title: "Upload Test",
                    iconCls: "icon-pagewhitecode",
                    buttons: [
                        {
                            id: "btnDocsClose",
                            text: "Close",
                            listeners: {
                                click: {
                                    fn: function (el, e) {
                                        Ext.getCmp('WinTest2').hide();
                                    }
                                }
                            }
                        }
                    ],
                    autoLoad: {
                        url: "ExtTest2.aspx?" + new Date().getTime(),
                        nocache: true,
                        mode: "iframe",
                        showMask: true,
                        triggerEvent: "show",
                        reloadOnEvent: true
                    }
                }
                parent.renderWindow(windowConfig);
                parent.Ext.getCmp("WinTest").hide();
            }
        </script>
        
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <div>
        <ext:Button ID="btnOpenWindow" runat="server" Text="Open New Window">
        <Listeners>
        <Click Handler="ShowTestWindow()" />
        </Listeners>
        </ext:Button>
        </div>
        </form>
    </body>
    </html>
    Test2...

    <%@ 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">
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Ext.Net.X.Call("showTest1Window");
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script language="javascript" type="text/ecmascript">
            var showTest1Window = function (e) {
                if (parent.Ext.getCmp('WinTest') != null)
                    parent.Ext.getCmp('WinTest').show();
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <div>
        
        </div>
        </form>
    </body>
    </html>
    Last edited by Daniil; May 10, 2012 at 1:52 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please remove:
    parent.Ext.getCmp("WinTest").hide();
    and replace
    fn : function (el, e) {
        Ext.getCmp('WinTest2').hide();
    }
    with
    fn : function () {
        this.ownerCt.ownerCt.hide();
    }

Similar Threads

  1. Create a button to close a window
    By Orwel in forum 2.x Help
    Replies: 2
    Last Post: Aug 10, 2012, 1:16 PM
  2. [CLOSED] how to close window after click button in this window
    By ViDom in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Jun 22, 2012, 3:48 PM
  3. Replies: 1
    Last Post: May 04, 2012, 2:35 PM
  4. [CLOSED] Desktop window close button on toolbar
    By llusetti in forum 1.x Legacy Premium Help
    Replies: 15
    Last Post: Jun 08, 2010, 7:41 PM
  5. Escape button doesn't close modal window
    By dbassett74 in forum Bugs
    Replies: 0
    Last Post: May 05, 2009, 9:26 PM

Tags for this Thread

Posting Permissions