[CLOSED] History control is unavailable in DocumentReady handler

  1. #1

    [CLOSED] History control is unavailable in DocumentReady handler

    Hi,

    This pattern used to work in v1.x but not any longer in v2.2. The History object has become unavailable in ResourceManager DocumentReady listener. Prefixing it with either App or Ext didn't make a difference. How can it be reconfigured properly?

    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System.Collections.Generic" %>
    <%@ Import Namespace="System.Globalization" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Button1_Click(object sender, DirectEventArgs e)
        {
            //Ext.History.Add("token here");
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>History - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    
        <script>
            if (window.parent.frames.length > 0) {
                window.open(window.location.pathname);
                window.location = "Warning.html";
            }
    
            var change = function (token) {
                if (token) {
                    var parts = token.split(":"),
                        tabPanel = Ext.getCmp(parts[0]),
                        tabId = parts[1];
    
                    if (tabPanel.id == "TabPanel2") {
                        App.TabPanel1.setActiveTab(0);
                    }
    
                    tabPanel.show();
                    tabPanel.setActiveTab(tabId);
                } else {
                    // This is the initial default state.  Necessary if you navigate starting from the
                    // page without any existing history token params and go back to the start state.
                    App.TabPanel1.setActiveTab(0);
                    App.TabPanel2.setActiveTab(0);
                }
            };
        </script>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager runat="server">
                <Listeners>
                    <DocumentReady Handler="alert(History1);"></DocumentReady>
                </Listeners>
            </ext:ResourceManager>
    
            <ext:History ID="History1" runat="server">
                <Listeners>
                    <Change Fn="change" />
                </Listeners>
            </ext:History>
    
            <ext:TabPanel
                ID="TabPanel1"
                runat="server"
                Height="300"
                Width="600"
                ActiveTabIndex="0">
                <Items>
                    <ext:Panel ID="Tab1" runat="server" Title="Tab1" Layout="Fit">
                        <Items>
                            <ext:TabPanel ID="TabPanel2" runat="server" ActiveTabIndex="0" TabPosition="Bottom">
                                <Items>
                                    <ext:Panel ID="SubTab1" runat="server" Title="Sub-tab 1" />
                                    <ext:Panel ID="SubTab2" runat="server" Title="Sub-tab 2" />
                                    <ext:Panel ID="SubTab3" runat="server" Title="Sub-tab 3" />
                                    <ext:Panel ID="SubTab4" runat="server" Title="Sub-tab 4" />
                                </Items>
                                <Listeners>
                                    <TabChange Handler="Ext.History.add(this.id + ':' + newTab.id);" />
                                </Listeners>
                            </ext:TabPanel>
                        </Items>
                    </ext:Panel>
    
                    <ext:Panel ID="Tab2" runat="server" Title="Tab 2" />
                    <ext:Panel ID="Tab3" runat="server" Title="Tab 3" />
                    <ext:Panel ID="Tab4" runat="server" Title="Tab 4" />
                    <ext:Panel ID="Tab5" runat="server" Title="Tab 5" />
                </Items>
                <Listeners>
                    <TabChange Handler="if (newTab.id != 'Tab1') {Ext.History.add(this.id + ':' + newTab.id);}" />
                </Listeners>
            </ext:TabPanel>
        </form>
    </body>
    </html>
    Last edited by Daniil; Apr 30, 2013 at 2:20 PM. Reason: [CLOSED]
  2. #2
    Hi Vadym,

    I think "App.History" should work. It is related to the item #90.
    https://examples2.ext.net/#/Getting_...AKING_CHANGES/
  3. #3
    Hi Daniil,

    Sorry, App.History1 gets resolved to "undefined" in the sample above.
  4. #4
    Hi Daniil,

    The code sample I've provided doesn't work for me.
  5. #5
    History doesn't share own id because it is singleton class
    Just use Ext.History to get reference on it
  6. #6
    Thanks Vladimir, that works.
  7. #7
    Sorry, I marked the thread as closed by my fault. I forgot that a History must be accessed by Ext.History.

Similar Threads

  1. [CLOSED] Security Error when using History control in IE6
    By jthompson in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Feb 17, 2012, 6:16 AM
  2. Replies: 2
    Last Post: Oct 27, 2011, 12:35 PM
  3. keyboard event handler ext.net control
    By eldhose in forum 1.x Help
    Replies: 0
    Last Post: Feb 13, 2011, 2:39 PM
  4. DocumentReady Listener not firing
    By Tbaseflug in forum 1.x Help
    Replies: 1
    Last Post: Aug 28, 2009, 2:16 PM
  5. Replies: 2
    Last Post: Mar 09, 2009, 2:55 PM

Tags for this Thread

Posting Permissions