简体   繁体   中英

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.

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())

I don't know which GXT version you are using. I am still using 2.x

Autoselect means, that the first tab is shown when the tab panel is displayed. So if you select two the first time the tab A should be displayed. Thats all what autoselect means. If you select two.B , switch to one and then back to two again, b will be displayed because that was the state when you left two .

You need to add an Listener to the com.extjs.gxt.ui.client.event.Events#Select event and select two.A by hand.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM