Hi Vaadins!
I’m trying to build an inline editor. I wan’t a combobox for a field, which values are dependent on the editing row.
With the following solution, I get a NPE for the bean of the editor.
ComboBox<String> comboBox = new ComboBox<>();
comboBox.setEmptySelectionAllowed(false);
comboBox.setDataProvider(new FetchItemsCallback<String>() {
@Override
public Stream<String> fetchItems(String filter, int offset, int limit) {
Bean bean = grid.getEditor().getBinder().getBean();
return valuesDependendOfBean(bean).stream();
}
}, new SerializableToIntFunction<String>() {
@Override
public int applyAsInt(String value) {
Bean bean = grid.getEditor().getBinder().getBean();
return valuesDependendOfBean(bean).size();
}
});
grid.getColumn(COLUMN_ID).setEditorBinding(binder.bind(comboBox, fieldName));