Search code examples
gwtgxt

Set default Tab selected for Tab panel for GXT


I have a application written in GXT. There are three tabs such as: One, Two, Three for example. For each tab, it is also a TabPanel, under each of One, Two, Three there are A, B and C.

One(A, B, C), Two(A, B, C), Three(A, B, C), I want to add a feature only for Two which is: A is the default tab view when you select Two.

It is OK when the application is first load. However, if you select B under Two, then select One or Three, then you click Two again, A is not default tab selected, B is default (I don't want the remember last select function)

Anyone knows how to implement that? The class for Two tab panel is very simple like:

twoTabPanel.add(aTab);
twoTabPanel.add(bTab);
twoTabPanel.add(cTab);

What is the method for TabPanel or how to implement this?

I tried the twoTabPanel.setAutoSelect(true), it doesn't work.


Solution

  • I am not sure if it could work in your case but have you tried to make your components statefull (false by default). see http://www.sencha.com/gxtdocs/#com.extjs.gxt.ui.client.widget.Component setStateFull

    Remember that statefull components need a defined id (component.setId())