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