Vaadin8 - Grid - EditMode - DynamicDatafields

Hi.

I try to add cloumn to my grid in a very flexible way. (Via ArrayList(Names) with 1:1 mapping to another - i know maps but thats not the point here :wink: )

for (int i = 0; i < nameList.size(); i++) {
	final int count = i;
	grid.addColumn(e -> e.getList().get(count)).setCaption(nameList.get(count));
}	

This works great to show dynamic lists. So if someone need this You’re welcome.
BUT: This doesnt work in Editmode.
Because i don’t know how to combine the setter with the get(count)
I need to point the setter like that: e.getList().set(count, newValue);

I would be grateful for every tip. thanks.

Yes, this is challenging to do with Vaadin 8 Grid. The Editor has been implemented in the way, that it requires the type info of the fields when it is opening and it is pretty hardwired in that and not overridable. I studied the problem while ago and the only reasonable way I can recommend for you is to create Grid with all columns as String. Then you can use TextField as editor for the cells. This ofcourse means that you cannot benefit advanced Fields like DateField or ComboBox. Also this would mean that your business logic needs to do the conversion between the String and actual persisted data types.