Remember active tab

  • Hi,

    Is a easy way to remenber active tab?

    In this thread jack said that was implement in next release: http://extjs.com/forum/showthread.php?t=227&highlight=tab+cookie

    Any ideas?


  • You could listen for TabPanel's beforechange event, or TabPanelItem's activate event


  • You will want to look at extending the behavior of getState, applyState and adding stateEvents to your TabPanel.

    getState should return information about what to store in the Provider.

    applyState should tell the component how to restore that state given the information.

    stateEvents dictate when state will be stored. Which events trigger storing state.


  • How does one do this in 2.0?

    I have a tab panel that loads on a page with no default active panel set.
    I have tried adding Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); to the top of my application and then adding stateEvents: ['activate'] to my tabpanel, but it doesn't appear to be creating any cookies when I activate a tab and when I refresh the page it goes back to the default of none active.


  • I didn't want to mess with extending Tabpanel for this kind of job, so I came up with this instead:


    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
    var mypanel = new Ext.Panel({
    layout: 'border',
    applyTo: 'body-div',
    height: 800,
    footer: true,
    autoShow: true,
    items:[{
    xtype: 'tabpanel',
    stateEvents: ['tabchange'],
    split: true,
    region: 'center',
    id: 'object_panel',
    activeTab: Ext.state.Manager.get('active_tab', 0),
    listeners: {
    'tabchange': function(){
    Ext.state.Manager.set('active_tab', Ext.getCmp('object_panel').getActiveTab().getId()) ;
    }
    },
    items:[ ... ]







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Remember active tab , Please add it free.