Reputation: 15927
In Vaadin 8's grid you would see the Save/Cancel button when doubleclicking on a row in GridPro
. In Vaadin 14 Grid Pro doesn't seem to have that save save/cancel button by default. Is there a way to enable it?
It seems like it should be possible because we have getEditor().addSaveListener()
etc.
As an extra question whenever I do any action in the grid it seems to only call the addCancelListener()
. Is there a reason for this? The primary question of course is if it's possible to show the save/cancel buttons in GridPro
Upvotes: 3
Views: 252
Reputation: 10623
GridPro
adds another editing functionality to the Grid
, which is not using grid.getEditor()
at all. So these are not to be mixed.
GridPro
is designed for cell-based spreadsheet like editing with improved keyboard navigation, thus save/cancel buttons are not there. Editable columns are added using grid.addEditColumn(..) method and using either built in fields like below, or custom type. In both cases saving of the value is handled in the call back provided.
grid.addEditColumn(Person::getEmail)
.text((item, newValue) ->
item.setEmail(newValue))
.setHeader("Email (editable)");
So save / cancel events from grid's editor are not emitted. Also this functionality does not use Binder
by default. You need wire Binder yourself if you need it, see example in Vaadin's cookbook.
Basic Grid
has builtin row based editor, which uses also Binder
. With that one you can use it Binder and editor in buffered mode, and for example add an additional component column to where you have edit / cancel buttons, what ever you like. There is rather good code example at Vaadin's component pages.
In summary there are two different editing facilities provided and these are not to be mixed.
Upvotes: 6