Search code examples
smartgwt

How to switch to a new tab


I currently have a TabSet of tabs.

List<Tab> tabList = new ArrayList<Tab>();
tabList.add(createTab("tab1", "Tab1", new TabPanel()));
tabList.add(createTab("tab2", "Tab2", new TabPanel()));
TabSet tabSet = new TabSet();
tabSet.setTabs(tabList.toArray(new Tab[tabList.size()]));

I want to be able to add a double click handler in a grid, by double clicking something, it will switch to one of the tabs Im not currently on. How do I achieve this?


Solution

  • In your click handler call selectTab() on the tabSet. Just pass in either the zero based index of the tab, the string id of the tab, or the particular Tab instance.