[CLOSED] Print external page in tabs

  1. #1

    [CLOSED] Print external page in tabs

    Hi,

    I have a tabpanel where I can add 1-n tabs.

    <Command Handler="#{WindowTourInfos}.show();addTab(#{TabPanelTourInfos}, record.data.TourNummer,record.data.CustomerTourNumber, 'showInfo.aspx?tourid='+record.data.TourNummer+'');" />
    The content of the tab is another aspx page

                <ext:XScript ID="XScript1" runat="server">
            <script>
                var addTab = function (tabPanel, id, cid, url) {
                    var tab = tabPanel.getComponent(id);
                    console.log(id);
                    if (!tab) {
                        tab = tabPanel.add({ 
                            id       : id, 
                            title    : "Tour "+cid, 
                            closable : true,
                            loader   : {
                                url      : url,
                                renderer : "frame",
                                loadMask : {
                                    showMask : true,
                                    msg      : "Lade Informationen zu Tour " + cid + "..."
                                }
                            }
                        });
    
                        tab.on("activate", function (tab) {
                          
                            var resultGrid = App.TourResultPanel;
                            var activeGrid = App.GridPanelActiveTours;
                            
                            var find = activeGrid.store.find('CustomerTourNumber', cid);
    
                            if (find != -1) {
                               //...
                            } else {
                                find = resultGrid.store.find('CustomerTourNumber', cid);
                                if (find != -1) {
                                    resultGrid.getView().select(find);
    
                                }
                            }
                            
                        });
                    }
                
                    tabPanel.setActiveTab(tab);
                }
            </script>
        </ext:XScript>

    Is there a way to print the content of the selected tab?
    Last edited by Daniil; Oct 22, 2013 at 2:40 PM. Reason: [CLOSED]
  2. #2
    Hi @blueworld,

    This should work:
    tabPanel.getActiveTab().getBody().print();
    If an iframe is loaded into a container via Loader, then a container's getBody method returns a global window object of that iframe.
  3. #3
    Works perfectly, thank you.

    Just a little thing, my print page has the title of the main page (the page that contains the tabpanel window). Is there any way to set the tab name as print page title?
  4. #4
    Hello!

    Quote Originally Posted by blueworld View Post
    Works perfectly, thank you.

    Just a little thing, my print page has the title of the main page (the page that contains the tabpanel window). Is there any way to set the tab name as print page title?
    Unfortunately, it's not possible because Ext.NET doesn't control the print method because it's provided by browser.
  5. #5
    Indeed, we don't control it.

    Though, I cannot reproduce the issue. I tried the following example in FireFox. The iframe is being printed with its "Child" title, not with "Parent".

    Parent
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Parent</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:TabPanel ID="TabPanel1" runat="server">
                <Items>
                    <ext:Panel runat="server" Title="Tab">
                        <Loader runat="server" Mode="Frame" Url="Test.aspx" />
                    </ext:Panel>
                </Items>
            </ext:TabPanel>
    
            <ext:Button runat="server" Text="Print">
                <Listeners>
                    <Click Handler="App.TabPanel1.getActiveTab().getBody().print();" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    Child
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Child</title>
    </head>
    <body>
        Child
    </body>
    </html>

Similar Threads

  1. [CLOSED] Move tabs Tabs Style Google Chrome
    By majunior in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 30, 2013, 12:58 PM
  2. [CLOSED] Load External Website
    By CPA1158139 in forum 2.x Legacy Premium Help
    Replies: 12
    Last Post: Mar 14, 2013, 2:26 PM
  3. Replies: 3
    Last Post: Aug 21, 2012, 11:43 AM
  4. Replies: 6
    Last Post: Feb 18, 2011, 2:12 PM
  5. Load External Website into an
    By Kamal in forum 1.x Help
    Replies: 3
    Last Post: Jul 25, 2009, 6:16 AM

Tags for this Thread

Posting Permissions