Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to reset SetVisibleColumn function?
If I execute the following code it will result in an error. This is because I set Visible Columns to two.
It need four before you repopulate the table. This is ok. My question,
Is there a function to reset the Visible Column list. Or should I just add another SetVisibleColumn function with all the table fields?
Chris
Table table = new Table("myTest");
table.addContainerProperty("date", Date.class, null, "Date", null, null);
table.addContainerProperty("quantity", Double.class, null, "Quantity (l)", null, null);
table.addContainerProperty("price", Double.class, null, "Price (e/l)", null, null);
table.addContainerProperty("total", Double.class, null, "Total (e)", null, null);
table.addGeneratedColumn("date",new DateColumnGenerator());
table.addGeneratedColumn("quantity",new ValueColumnGenerator("%.2f l"));
table.addGeneratedColumn("price",new PriceColumnGenerator());
table.addGeneratedColumn("total",new ValueColumnGenerator("%.2f e"));
table.setVisibleColumns(new Object[] {"date", "quantity"});
table.addGeneratedColumn("date",new DateColumnGenerator()); <- result in en error
table.addGeneratedColumn("quantity",new ValueColumnGenerator("%.2f l"));
table.addGeneratedColumn("price",new PriceColumnGenerator());
table.addGeneratedColumn("total",new ValueColumnGenerator("%.2f e"));
The problem here is not the setVisibleComlumns()-call but the fact that you are adding a generated column with an already used id.
I picked this example from the vaadin book.
In my code I use null as Id.
Chris
Using null as id probably is problematic.
As for resetting the visible columns, if nothing else helps, try table.setContainerDataSource(table.getContainerDataSource()). It does reset a lot more than just visible columns, though.