I have a Vaadin (7.6.7) grid, that shows a combobox when in editor mode. Another action can modify the items of the combobox, but the combobox in the grid does not update itself.
grid.getColumn("id").setEditorField(theBox).setConverter(new Converter<String, String>() {
@Override
public String convertToModel(String value, Class<? extends String> targetType, Locale locale) throws ConversionException {
retu value; // not sure for what this is required
}
@Override
public String convertToPresentation(String value, Class<? extends String> targetType, Locale locale) throws ConversionException {
// don't show the id, but the name
A a = endpoint.getA(value);
retu a.getName();
}
@Override
public Class<String> getModelType() {
retu String.class;
}
@Override
public Class<String> getPresentationType() {
retu String.class;
}
});
theBox is a Combobox that is filled before - the initial display is correct (it contains objects of type A)
Now another action manipulates the objects of type A, e.g. delete an object.
How can I update now the combobox in the grid ?
I tried
theBox.removeAllItems();
List<A> as = endpoint.getAs();
teamBox.setContainerDataSource(new BeanItemContainer<>(String.class, as.stream().map(A::getIdent).collect(Collectors.toList())));
for (A each : as) {
theBox.setItemCaption(a.getId(), a.getName());
}
to call before, but when editing the grid, the theBox shows still the old values.
What do I miss ?
