Announcement

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

    Tab content can't be reused?

    I would like to reuse content in my new tab.
    Example,
    i)"Layout_A" is a singleton and set to "Tab_A".
    ii)"Tab_A" can be closed.
    iii)a new "Tab_B" is created and set the "Layout_A" in "Tab_B" pane.


    // my variables
    private final TabSet tabSet = new TabSet();
    private final VLayout tabContent=new VLayout();

    private void testTabClose() {
    final Tab tab = new Tab();
    tab.setTitle("Tab #1");
    tab.setPane(tabContent);
    tabSet.addTab(tab);
    tabSet.selectTab(tab);
    tab.setCanClose(true);
    tabContent.addMember(new Label("TEST CONTENT"));
    final VLayout layout = new VLayout();
    tabSet.setWidth100();
    tabSet.setHeight100();
    IButton addButton=new IButton("Add New Tab");
    addButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
    public void onClick(ClickEvent event) {
    Tab tab=new Tab("New Tab");
    tab.setCanClose(true);
    tabSet.updateTab(tab, tabContent);
    }
    });
    layout.addMember(addButton);
    layout.addMember(tabSet);
    layout.setWidth100();
    layout.setHeight100();
    final HLayout mainLayout = new HLayout();
    mainLayout.setWidth100();
    mainLayout.setHeight100();
    mainLayout.addMember(layout);
    mainLayout.draw();

    }

    #2
    When a tab is close its content is destroyed by default, you need to set TabSet.setDestroyPanes(false)

    Comment


      #3
      Thank you! This solved my problem.

      Comment

      Working...
      X