Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • Hide tab from a TabSet

    Is there anyway to hide a tab which was already added to a TabSet ?

  • #2
    Use removeTab(). There isn't a way to hide the tab, just re-add the same tab with addTab() later if you want it again.

    Comment


    • #3
      Hello,

      I will bring this thread back to life, because removing tab from tabset will cause: "The pane associated with the removed tab is automatically destroyed... To avoid this, call updateTab with null as the new pane immediately before removing the tab.".

      But, setting null as new pane for tab will cause override old pane (obviously) so you have keep old pane for later re-use. I am right?

      Little example:
      Code:
      	public void onModuleLoad() {
      		final TabSet ts = new TabSet();
      		ts.setSize("400px", "400px");
      		Tab tab1 = new Tab();
      		Button add = new Button("Add");
      		tab1.setPane(add);
      		
      		final Tab tab2 = new Tab();
      		final Button rem = new Button("Remove");
      		tab2.setPane(rem);
      		ts.addTab(tab1);
      		ts.addTab(tab2);
      		ts.show();
      		add.addClickHandler(new ClickHandler() {
      			
      			@Override
      			public void onClick(ClickEvent event) {
      				tab2.setPane(rem);
      				ts.addTab(tab2); 
      			}
      		});
      		rem.addClickHandler(new ClickHandler() {
      			
      			@Override
      			public void onClick(ClickEvent event) {
      				ts.updateTab(tab2, null);
      				ts.removeTab(tab2); 
      			}
      		});
      		
      	}
      ..or, it's here some better solution to hide/show tabs in tabset? E.g. create more tabsets with desired tabs without need of hiding them? (and can I use same tab in multiple tabsets or have I create its clones)

      Comment

      Working...
      X