PDA

View Full Version : Different TabItem behaviour!?



marswe
17 Jun 2008, 6:58 AM
I have a TabPanel created in a View which I store in the Registry:



protectedvoid initUI() {
viewport = new Viewport();
viewport.setLayout(new CenterLayout());

ContentPanel panel = new ContentPanel();
panel.setBodyBorder(false);
panel.setHeaderVisible(false);
panel.setSize(600,600);
panel.setScrollMode(Scroll.AUTO);

tab = new TabPanel();
tab.setBodyBorder(false);
Registry.register("tabPanel", tab);

panel.add(tab);

viewport.add(panel);

RootPanel.get().add(viewport);
}


When I later on in another view loads the TabPanel and adds a tabItem I do like this:



TabPanel tab = (TabPanel) Registry.get("tabPanel");
searchTab = new TabItem(constants.searchTabCaption());
searchTab.setClosable(false);
searchTab.add(panel);
tab.add(searchTab);


When I then start my application none tab is selected so unless I click on the tab I don't the tab content and then it looks ok. But if I instead add the line


tab.setSelection(searchTab);
the tab is indeed selected but the layout does not look good, i.e. the table heading on a table in the tabitem together with two buttons does not look good.

What could be the problem?

/Markus

darrellmeyer
17 Jun 2008, 8:15 AM
If you post you sample code in this format (http://extjs.com/forum/showthread.php?t=33778) I will take a look.

marswe
17 Jun 2008, 11:10 PM
Ok, I tried a different approach and instead of putting the tabpanel itself in the registry I created a tabitem, added it to the tabpanel and put that into the registry. Then it worked!