I’m using Vaadin 14.0.0.beta2 and I have a several tabs and a combobox on one tab. When I switch to another tab and then switch back to the tab that contains the combobox I get a (TypeError): $0.$connector is undefined and the combobox no longer works, that is I can’t click on it to see the values in it and make a selection. Below is the minimal code to reproduce the error:
import java.util.HashMap;
import java.util.Map;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.combobox.ComboBox;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.page.Push;
import com.vaadin.flow.component.tabs.Tab;
import com.vaadin.flow.component.tabs.Tabs;
import com.vaadin.flow.router.Route;
@Push
@Route("test")
public class TestView extends VerticalLayout{
private static final long serialVersionUID = 1L;
private Tab tab1=new Tab("Tab 1");
private Tab tab2=new Tab("Tab 2");
private Tab tab3=new Tab("Tab 3");
private Tabs tabs=new Tabs(tab1,tab2,tab3);
private Map<Tab,Component> tabsToPages=new HashMap<>();
private VerticalLayout content=new VerticalLayout();
public TestView() {
this.setSizeFull();
this.content.setSizeFull();
this.add(tabs,content);
VerticalLayout vl1Content=new VerticalLayout();
vl1Content.setSizeFull();
ComboBox<String> comboBox=new ComboBox<>();
comboBox.setItems("one","two","three","four");
comboBox.setValue("one");
vl1Content.add(comboBox);
VerticalLayout vl2Content=new VerticalLayout();
vl2Content.setSizeFull();
vl2Content.add(new Span("Tab 2 content"));
VerticalLayout vl3Content=new VerticalLayout();
vl3Content.setSizeFull();
vl3Content.add(new Span("Tab 3 content"));
tabsToPages.put(tab1, vl1Content);
tabsToPages.put(tab2, vl2Content);
tabsToPages.put(tab3, vl3Content);
content.add(vl1Content);
tabs.addSelectedChangeListener(event -> {
content.removeAll();
content.add(tabsToPages.get(tabs.getSelectedTab()));
});
}
Any ideas as to how to fix this?
Thanks.