2 * Ext JS Library 2.2.1
\r
3 * Copyright(c) 2006-2009, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://extjs.com/license
\r
10 Ext.onReady(function() {
\r
12 // The only requirement for this to work is that you must have a hidden field and
\r
13 // an iframe available in the page with ids corresponding to Ext.History.fieldId
\r
14 // and Ext.History.iframeId. See history.html for an example.
\r
17 // Needed if you want to handle history for multiple components in the same page.
\r
18 // Should be something that won't be in component ids.
\r
19 var tokenDelimiter = ':';
\r
21 var tp = new Ext.TabPanel({
\r
22 renderTo: Ext.getBody(),
\r
33 tabPosition: 'bottom',
\r
47 'tabchange': function(tabPanel, tab){
\r
48 Ext.History.add(tabPanel.id + tokenDelimiter + tab.id);
\r
66 'tabchange': function(tabPanel, tab){
\r
67 // Ignore tab1 since it is a separate tab panel and we're managing history for it also.
\r
68 // We'll use its handler instead in that case so we don't get duplicate nav events for sub tabs.
\r
69 if(tab.id != 'tab1'){
\r
70 Ext.History.add(tabPanel.id + tokenDelimiter + tab.id);
\r
76 // Handle this change event in order to restore the UI to the appropriate history state
\r
77 Ext.History.on('change', function(token){
\r
79 var parts = token.split(tokenDelimiter);
\r
80 var tabPanel = Ext.getCmp(parts[0]);
\r
81 var tabId = parts[1];
\r
84 tabPanel.setActiveTab(tabId);
\r
86 // This is the initial default state. Necessary if you navigate starting from the
\r
87 // page without any existing history token params and go back to the start state.
\r
89 tp.getItem(0).setActiveTab(0);
\r