Version: 8.0.0.beta1
The functions Grid.setFrozenColumnCount, Column.setHidable and Column.setHidden do not work properly.
If you click on the Button ‘Change Grid’ in the following code, nothing happens (only the progress bar on the top is blinking):
Grid<Car> grid1 = new Grid<>();
Grid<Car> grid2 = new Grid<>();
List<Car> cars = new ArrayList<>();
cars.add(new Car("Car 1"));
cars.add(new Car("Car 2"));
cars.add(new Car("Car 3"));
CarDataProvider cdp = new CarDataProvider(cars);
grid1.setDataProvider(cdp);
grid2.setDataProvider(cdp);
Column<Car, String> col1 = grid1.addColumn(new ValueProvider<Car, String>() {
private static final long serialVersionUID = 1L;
@Override
public String apply(Car car) {
return car.getPlate();
}
});
Column<Car, String> col2 = grid2.addColumn(new ValueProvider<Car, String>() {
private static final long serialVersionUID = 1L;
@Override
public String apply(Car car) {
return car.getPlate();
}
});
col1.setCaption("Cars of grid1");
col2.setCaption("Cars of grid2");
grid1.setFrozenColumnCount(1); // breaks it
col1.setHidable(true); // breaks it if you hide col1 in the grid
col1.setHidden(true); // breaks it
Button toggleButton = new Button("Change Grid");
toggleButton.addClickListener(event -> {
if (grid1.getParent() == vl) {
vl.replaceComponent(grid1, grid2);
} else {
vl.replaceComponent(grid2, grid1);
}
});
Button helloButton = new Button("Hello");
helloButton.addClickListener(event -> Notification.show("Hello"));
vl.addComponent(toggleButton);
vl.addComponent(helloButton);
vl.addComponent(grid1);