I'm looking for a way to dynamically add columns to a vaadin table.
I tried this:
private Button createAddColumnButton() {
Button addProductButton = new Button("Add column");
addProductButton.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
count = count++;
table.addGeneratedColumn("Column "+count, new ColumnGenerator() {
@Override
public Object generateCell(final Table source, Object itemId, Object columnId) {
String x = "some stuff";
return x;
}
});
}
});
return addProductButton;
}
This button allowed me dynamically add a column, however only one column before I recieved an error saying I cannot have two columns with the same id. How can I change the ID so it is unique & add lots of columns?