Question

I want to know how to add tab dynamically in vaadin tabsheet. I am having TabSheet which consists of two tabs. First tab has one button.If we click that button then another tab should add dynamically in the tabsheet.Can anyone tell me how to achieve this.

Was it helpful?

Solution

Check out the demos, code samples, and API docs here.

final TabSheet tabSheet = new TabSheet();

Button button = new Button("Add the tab");
button.addListener(new Button.ClickListener(){
    public void buttonClick(ClickEvent event) {
        VerticalLayout content = new VerticalLayout();
        content.addComponent(new Label("This is the tab content."));
        Tab tab = tabSheet.addTab(content, "The new Tab", null);
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top