Using vaadin version: 7.4.2
Adding to a Grid container while toggling the visibility of items above it causes a weird client side exception that can only be detected by running the application in debug mode with the ?debug parameter. The result of the exception is that the first item in the container disappears and the first row seems to merge with the second.
Source Code:
Please excuse any typos. I had to type the source code by hand. [code]
public class TestGrid extends VerticalLayout implements View {
public TestGrid() {
BeanItemContainer<TestBean> container = new BeanItemContainer<>(TestBean.class, createBeans(5));
Button newButton = new Button("New");
Button save = new Button("Save");
TextField textField = new TextField("Name");
Layout saveSection = new FormLayout(textField, save);
saveSection.setVisible(false);
addComponents(newButton, saveSection);
newButton.addClickListener(e -> {
saveSection.setVisible(true);
newButton.setVisible(false);
});
save.addClickListener(e -> {
container.addBean(new TestBean(textField.getValue()));
saveSection.setVisible(false);
newButton.setVisible(true);
});
Grid grid = new Grid(container);
grid.getColumn("name").setHeaderCaption("Name");
addComponent(grid);
}
private List<TestBean> createBeans(int count) {
// Omitting for brevity. Returns an Array of beans with size = count.
}
// Omitting override for enter method.
public static class TestBean {
String name;
public TestBean(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
}
[/code]