opening severall time a desktop window

  1. #1

    opening severall time a desktop window

    Hello

    I'm facing a problem :

    I have to open several time the same window into a desktop. The content of the window wil depend of url loading in a grid.

    For now, I manage to do that by creating a window with the method shows in the example called dynamic window and passing it an url with autoload parameter. But I want to know if it was possible to have such a behavior with a window defined into the aspx page as a ext.desktopwindow. I found nothin about that.

    In fact, I have a problem because in the window I opened after clicking on my URL, I called a new window to show other datas and I didn't manage to make this last windows belong to the desktop.

    It is very difficult to show an example of what I do, because I have 3 pages involved and 2 js files.
  2. #2
    Hi,

    You should create a new window.

    Example
    <%@ 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>Ext.NET Example</title>
    
        <script type="text/javascript">
            var createDynamicWindow = function (app) {
                var desk = app.getDesktop();
    
                var w = desk.createWindow({
                    title  : "Dynamic Web Browser",
                    width  : 1000,
                    height : 600,
                    maximizable : true,
                    minimizable : true,
                    autoLoad : {
                        url  : "http://ext.net/",
                        mode : "iframe",
                        showMask : true
                    }
                });
    
                w.center();
                w.show();
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Desktop ID="Desktop1" runat="server" BackgroundColor="black">
                <Modules>
                    <ext:DesktopModule ModuleID="DesktopModule1" WindowID="DesktopWindow1" />
                </Modules>
                <Shortcuts>
                    <ext:DesktopShortcut ModuleID="DesktopModule1" Text="Shortcut" />
                </Shortcuts>
                <StartMenu>
                    <Items>
                        <ext:MenuItem Text="DesktopWindow1">
                            <Listeners>
                                <Click Handler="DesktopWindow1.show();" />
                            </Listeners>
                        </ext:MenuItem>
                        <ext:MenuItem Text="Create dynamic" Icon="World">
                            <Listeners>
                                <Click Handler="createDynamicWindow(#{Desktop1});" />
                            </Listeners>
                        </ext:MenuItem>
                    </Items>
                </StartMenu>
            </ext:Desktop>
            <ext:DesktopWindow ID="DesktopWindow1" runat="server" Title="DesktopWindow" />
        </form>
    </body>
    </html>
  3. #3
    Hello

    Thanks to answer.

    You'r right and it is what I made for the second window I create...But when I click on a row in this second window to show a new one with data then I was not able to pass throuh the desktop information, so I'm not able to made this third window a desktop window.In fact my problem is to pass the desktop information to the url called for the creation of this new window. I try to pass it through a post data but I receive a string :[object object] : fail.

    To try to claryfy:

    First window is called from desktop menu. When desktop is created I save the desktop element in a global javascript variable
    Second window is called by the way you show when I clink on a link in the frist window created and I use previous save desktop variable to attach it to desktop. so far so good
    But when I click on a row of this second window, my global deskto variable is not reachable and I don't know hot to pass it to the window creation function.

    The javascript called to create the second window :

               function DaylinkClick(LinkParam){
    
                    var winTitle="";
                    var Status = LinkParam.substring(7,LinkParam.indexOf("&"));
                    var date = LinkParam.substring(LinkParam.indexOf("&")+6,LinkParam.lastIndexOf("&"))
                    if (date != "")
                        {
                            winTitle = "Liste des RMA  statut : " + Statut ;
                        }
                    else
                        {
                            switch (Status)
                                {
                                    case "":
                                        winTitle="Liste des RMA";
                                        break;
                                    case "ATraiter":
                                        winTitle="Liste des RMA en cours de traitement atelier";
                                        break;
                                    case "AControler":
                                        winTitle="Liste des RMA à controler";
                                        break;
                                    case "Devis":
                                        winTitle="Liste des RMA en attente de devis";
                                        break;
                                    default:
                                        winTitle="Liste des RMA statut : " + Status;
                                        break;
                                }
                        };
                          
                        var win = createWindow(winTitle, "lstRMA.aspx?" + LinkParam);         
    
                        win.show();
                                    
                };
                
                function DaylinkRenderer(value, meta, record){                        
                    if(value=="0")
                        return String.format("{0}", value);           
                    else
                        return String.format("<a class='Header-link' href='#' onclick='DaylinkClick(\"{1}\");'>{0}</a>", value,stoGrd0.getById(record.id).get("DayURL"));
                }
    the main.js file included in my first aspx page :

    var desktop;
     
    function createWindow(winTitle, url)
        {
        
            //var win = new parent.window.Ext.Window({
            var win = desktop.createWindow({
                title: winTitle,
                width: 1000,
                height: 500,
                minimizable:true,
                maximizable: true,
                layout:'fit',
                autoLoad: {
                    showMask: true,
                    mode: "iframe",
                    url: url
                    }
                });
            return win;     
        };
    the function to save desktop data into desktop variable :

               var storeIDDesktop = function (app)
                    {
                        desktop=app.getDesktop();
                    };
    this function is called when my desktop is ready :

                            <ext:Desktop 
                    ID="MyDesktop" 
                    runat="server" 
                    BackgroundColor="Black" 
                    ShortcutTextColor="White" 
                    Wallpaper="images/DesktopImages/desktop.jpg">
                    <StartButton Text="Start" IconCls="start-button" />
                    <%-- NOTE: Body Controls must be added to a container with position:absolute --%>
                    <Listeners>
                        <Ready Handler="storeIDDesktop(#{MyDesktop})"/>                   
                    </Listeners>
                    <Modules>
                        <ext:DesktopModule ModuleID="DesktopModule1" WindowID="winBacklog" AutoRun="true">
                        </ext:DesktopModule>
                    </Modules>  
    
       ............</Desktop>
    the lstRMA.aspx page called to create second window :

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="lstRMA.aspx.vb" Inherits="VisualManagement.lstRMA" %>
    <%@ 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>Untitled Page</title>
                <link rel="stylesheet" type="text/css" href="NextGen.css" />        
                <script type="text/javascript" language="javascript" src="jsFile/MainSubWindow.js"></script>
         </head>
        <body>
        
               <script type="text/javascript">
    
                
                    function createRMAWindow(RMA)
                        {
                                var win = createWindow("RMA n° " + RMA, "lstRMADetail.aspx?RMA=" + RMA);         
    
                                win.show();
                        };
                </script>
                
            <form id="form1" runat="server">
                <ext:ResourceManager ID="ResourceManager1" runat="server">
                </ext:ResourceManager>
    
                <ext:GridPanel 
                    runat="server"
                    ID="grdListeRMA" AutoExpandColumn="RMA" AutoExpandMax="80" AutoExpandMin="80" AutoHeight="true" AutoWidth="True" TrackMouseOver="True" AutoScroll="True" Cls="x-grid-custom-Backlog2">
                    <ColumnModel ID="ColumnModel1" runat="server">
                        <Columns>
                            <ext:RowNumbererColumn />
                            <ext:Column ColumnID="RMA" DataIndex="RMA" Header="RMA" Editable="False" Align="Center"></ext:Column>
                            <ext:Column ColumnID="eRMA" DataIndex="eRMA" Header="e-RMA" Align="Center"></ext:Column>
                            <ext:Column ColumnID="Serial" DataIndex="Serial" Header="N° de série" Align="Center"></ext:Column>
                            <ext:Column ColumnID="Status" DataIndex="Status" Header="Statut courant" Align="Center"></ext:Column>
                            <ext:Column ColumnID="dDateMaj" DataIndex="dDateMaj" Header="Date de maj du statut" Align="Center" Width="150px"></ext:Column>
                            <ext:Column ColumnID="Tech" DataIndex="Tech" Header="Technicien" Align="Center"></ext:Column>
                            <ext:Column ColumnID="ETTR" DataIndex="ETTR" Header="ETTR" Align="Center"></ext:Column>
                            <ext:Column ColumnID="Delay" DataIndex="Delay" Header="Délai depuis dernier statut" Align="Center" Width="170px"></ext:Column>
                        </Columns>
                    </ColumnModel>
                    <Store>
                        <ext:Store 
                            runat="server" 
                            ID="stoListe">
                            <Proxy>
                                <ext:HttpProxy Url="" Json="false" Timeout="3000"></ext:HttpProxy>
                            </Proxy>
                            <Reader>
                                <ext:JsonReader>
                                    <Fields>
                                        <ext:RecordField Name="RMA" />
                                        <ext:RecordField Name="eRMA" />
                                        <ext:RecordField Name="Serial" />
                                        <ext:RecordField Name="Status" />
                                        <ext:RecordField Name="dDateMaj" />
                                        <ext:RecordField Name="Tech" />
                                        <ext:RecordField Name="ETTR" />
                                        <ext:RecordField Name="Delay" />
                                    </Fields>
                                </ext:JsonReader>                
                            </Reader>
                        </ext:Store>
                    </Store>
                    <LoadMask ShowMask="true" />
                    <SelectionModel>
                        <ext:RowSelectionModel ID="RowSelectionModel1" runat="server">
                            <Listeners>
                                <RowSelect Handler="createRMAWindow(#{grdListeRMA}.getSelectionModel().getSelected().json.RMA);" />
                            </Listeners>
                        </ext:RowSelectionModel>
                    </SelectionModel>
                </ext:GridPanel>
                
                <ext:TaskManager ID="timerLstRMA" runat="server" Enabled="True">
                    <Tasks>
                        <ext:Task 
                            TaskID="taskLstRMA"
                            Interval="60000" AutoRun="True">
                            <DirectEvents>
                                <Update OnEvent="RefreshLstRMA">
                                    <EventMask 
                                        ShowMask="true" 
                                        Target="CustomTarget" 
                                        CustomTarget="grdListeRMA" 
                                        MinDelay="350"
                                        />
                                </Update>
                            </DirectEvents>                    
                        </ext:Task>
                    </Tasks>
                </ext:TaskManager>        
            </form>
        </body>
    </html>
    and its javascript embeded file here I don't know hot to get desktop information to attache the third window to :

    function createWindow(winTitle, url)
        {
        
            var win = new parent.window.Ext.Window({
            //var win = desktop.createWindow({
                title: winTitle,
                width: 1000,
                height: 500,
                minimizable:true,
                maximizable: true,
                layout:'fit',
                autoLoad: {
                    showMask: true,
                    mode: "iframe",
                    url: url
                    }
                });
            return win;     
        };
    Here 3 screen captures of the process

    I hope there is a solution because I really need all my window belongued to the desktop, and I need to called several time the same window with different data shows for compare reason.
    Attached Thumbnails Third one called by cliking a row in second window.jpg   First window called by desktop menu.jpg   Second window called by link from first one.jpg  
    Last edited by feanor91; Dec 22, 2011 at 7:14 AM.
  4. #4
    You can access a parent page from an iframe and, respectivelly, a Desktop instance.
    parent.Desktop1
  5. #5
    thanks, I will try that

    Edit :

    Wonderfull! it works!!!

    Here the complete function :

    function createWindow(winTitle, url)
        {
        
            var desktop  = parent.desktop;
            var win = desktop.createWindow({
                title: winTitle,
                width: 1000,
                height: 500,
                minimizable:true,
                maximizable: true,
                layout:'fit',
                autoLoad: {
                    showMask: true,
                    mode: "iframe",
                    url: url
                    }
                });
            return win;     
        };
    Last edited by feanor91; Dec 22, 2011 at 12:03 PM.

Similar Threads

  1. Opening Window at required position
    By designworxz in forum 1.x Help
    Replies: 1
    Last Post: Jan 11, 2012, 2:39 PM
  2. [CLOSED] Problem opening multiple tabpanels the same time.
    By majunior in forum 1.x Legacy Premium Help
    Replies: 58
    Last Post: Jun 01, 2011, 8:39 PM
  3. Replies: 8
    Last Post: Jun 23, 2010, 10:16 AM
  4. on opening windows in a desktop
    By [WP]joju in forum 1.x Help
    Replies: 6
    Last Post: Oct 28, 2009, 7:36 AM
  5. error on opening a window
    By Kamal in forum 1.x Help
    Replies: 2
    Last Post: Oct 12, 2009, 5:10 PM

Posting Permissions