Vaadin 8 Grid: Combobox validation fails

Hi everyone,

first of all, I can’t access the subforum “Framework Data Binding”:

Something unexpected happened. Please try reloading the page.

Now to my problem:
I have a grid, with customized column validation in form of:

Validator<String> validator = new Validator<String>() {
     @Override
     public ValidationResult apply(String value, ValueContext context) {
         return isValidValue(value);
     }
};
Binding<ObjectNode, String> fieldBinding = binder.forField(fieldSelect).withValidator(validator).bind(json -> json.get(fieldName).textValue(),
      (json, fieldValue) -> json.put(fieldName, fieldValue));

When I now edit a ComboBox value via inline editor, than everything works fine:
If the value is empty, the value isn’t valid and otherwise around the value is valid.

Before I allow now the commiting of the Grid changes I check again for validation:

if (!grid.getEditor().getBinder().isValid()) {
      grid.setComponentError(new UserError(UIConfiguration.MESSAGE_INPUT_VALIDATION_FAILED));
      return false;
}

But here is the Combobox value always empty and therefore the validation always fails.

Can you tell me, why there is no value given for the validation?
If it isn’t the correct way to validate an entire Grid, how can I do that instead?

Best regards,
Sebastian

Apparently when you use
grid.getEditor().getBinder().isValid()
the values of all fields are always null. Is it a bug?
The values are only provided, when the inline editor calls the validation.

Best regards,
Sebastian

P.S.: I’m using
ListDataProvider
and
grid = new Grid<>(dataProvider);
for filling the grid.[code]
ListDataProvider dataProvider = retrieveList();

Grid grid = new Grid<>(dataProvider);
grid.getEditor().setEnabled(true);
Binder binder = grid.getEditor().getBinder();

//
// repeated for all fields
//
String fieldName = “field1”;
TextField fieldEdit = new TextField();

Validator validator = new Validator() {
@Override
public ValidationResult apply(String value, ValueContext context) {
return isValidValue(value);
}
};

Binding<ObjectNode, String> fieldBinding = binder.forField(fieldEdit).withValidator(validator).bind(json → json.get(fieldName).textValue(),
(json, fieldValue) → json.put(fieldName, fieldValue));

grid.addColumn(json → json.get(fieldName).textValue()).setCaption(fieldName).setId(fieldName).setEditorBinding(fieldBinding);

//
// Somewhere triggered by a final commit button:
//
if (!grid.getEditor().getBinder().isValid()) {
grid.setComponentError(new UserError(UIConfiguration.MESSAGE_INPUT_VALIDATION_FAILED));
return false;
}
[/code]

Apparently my usecase is not possible like this.
I go with this solution now:

for (ObjectNode row : rowList) {
  grid.getEditor().getBinder().setBean(row);
  if (!grid.getEditor().getBinder().isValid()) {
    grid.getEditor().getBinder().removeBean();
    grid.setComponentError(new UserError(UIConfiguration.MESSAGE_INPUT_VALIDATION_FAILED));
    return false;
  }
  grid.getEditor().getBinder().removeBean();
}