Enable 'Save' button in CRUD editor

I have a crud editor (extending BinderCrudEditor) that contains several grids that show collections of items, as well as TextFields, etc. When I make an edit to a TextField the ‘Save’ button is activated. However, when I add or remove an item from the collection shown in the grid (via a dialog) the ‘Save’ button does not change state. How can I get the Save button to become enabled due to a change in the collection in the grid? Alternatively, how can I default the ‘Save’ button to enabled?

At a guess, I’d say it is because the Grid does not implement HasValue, and as such is not a form component (only a visualization). Form components (like TextField) do implement the interface and have internal listener functionality that lets Binder know when the value has changed.

You say you show collections of items with a grid, and change the collection; how do you bind this property to the Binder? how do you modify the collection that you show in the grid?

Actually; a correction. Grid does work with Binder, using grid.asMultiSelect(). Is that what you are using?


This problem of Save button not becoming enabled is related to the components not containing any input or change field that could trigger the input or change listener within the vaadin-crud.html polymer template.

You will encounter the same issue even if you had a custom field implementing the HasValue but not containing any input or change field.

There is a workaround that might help in here https://github.com/vaadin/vaadin-crud-flow/issues/128