Interface DataGridEditor<T>
- Type Parameters:
T
- the type of the row/item being edited
- All Superinterfaces:
com.vaadin.flow.component.grid.editor.Editor<T>
,Serializable
- All Known Implementing Classes:
DataGridEditorImpl
public interface DataGridEditor<T>
extends com.vaadin.flow.component.grid.editor.Editor<T>
An editor in a Grid.
This class contains methods for editor functionality: configure an editor, open the editor, save and cancel a row editing, utility methods for defining column edit components.
-
Method Summary
Modifier and TypeMethodDescriptiongetItem()
void
initColumnDefaultEditorComponent
(com.vaadin.flow.component.grid.Grid.Column<T> column, String property) Inits the default function that returns the column editor component that is bound to the passed entity's property.void
initColumnDefaultEditorComponent
(String property) Inits the default function that returns the column editor component that is bound to the passed entity's property.boolean
isSaving()
void
setColumnEditorComponent
(com.vaadin.flow.component.grid.Grid.Column<T> column, String property, Function<EditComponentGenerationContext<T>, com.vaadin.flow.component.Component> generator) Sets a function that returns the column editor component.void
setColumnEditorComponent
(String property, Function<EditComponentGenerationContext<T>, com.vaadin.flow.component.Component> generator) Sets a function that returns the column editor component.void
Sets a callback that is set to editor components which implementSupportsStatusChangeHandler
.void
setValidationErrorsHandler
(Consumer<ValidationErrors> validationErrorsHandler) Sets a callback that is used to handle validation errors when Editor attempts to save the data, i.e.Methods inherited from interface com.vaadin.flow.component.grid.editor.Editor
addCancelListener, addCloseListener, addOpenListener, addSaveListener, cancel, closeEditor, editItem, getBinder, getGrid, isBuffered, isOpen, refresh, save, setBinder, setBuffered
-
Method Details
-
getItem
- Specified by:
getItem
in interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
isSaving
boolean isSaving()- Returns:
true
if this editor is buffered and is in a process of writing data to an item,false
otherwise
-
initColumnDefaultEditorComponent
Inits the default function that returns the column editor component that is bound to the passed entity's property. To find the column it's assumed that the column key is equal to the property.- Parameters:
property
- an entity attribute for which the edit component is created- See Also:
-
setColumnEditorComponent
void setColumnEditorComponent(String property, Function<EditComponentGenerationContext<T>, com.vaadin.flow.component.Component> generator) Sets a function that returns the column editor component. To bound an editor component to the passed entity's property, the function implementation should useEditComponentGenerationContext.getValueSourceProvider()
to obtain an instance ofValueSource
. To find the column it's assumed that the column key is equal to the property.- Parameters:
property
- an entity attribute for which the edit component is createdgenerator
- a callback function that is used to create an edit component- See Also:
-
initColumnDefaultEditorComponent
void initColumnDefaultEditorComponent(com.vaadin.flow.component.grid.Grid.Column<T> column, String property) Inits the default function that returns the column editor component that is bound to the passed entity's property.- Parameters:
column
- a grid column for which to set editor componentproperty
- an entity attribute for which an edit component is created- See Also:
-
setColumnEditorComponent
void setColumnEditorComponent(com.vaadin.flow.component.grid.Grid.Column<T> column, String property, Function<EditComponentGenerationContext<T>, com.vaadin.flow.component.Component> generator) Sets a function that returns the column editor component. To bound an editor component to the passed entity's property, the function implementation should useEditComponentGenerationContext.getValueSourceProvider()
to obtain an instance ofValueSource
.- Parameters:
column
- a grid column for which to set editor componentproperty
- an entity attribute for which the edit component is createdgenerator
- a callback function that is used to create an edit component- See Also:
-
setDefaultComponentStatusHandler
void setDefaultComponentStatusHandler(@Nullable Consumer<SupportsStatusChangeHandler.StatusContext<?>> handler) Sets a callback that is set to editor components which implementSupportsStatusChangeHandler
. If a custom component generator is used, this status handler can be obtained fromEditComponentGenerationContext.getStatusHandler()
.- Parameters:
handler
- a callback that is set to editor components which implementSupportsStatusChangeHandler
-
setValidationErrorsHandler
Sets a callback that is used to handle validation errors when Editor attempts to save the data, i.e. whenEditor.save()
is invoked.Note! This handler can be called only if editor is in buffered mode.
- Parameters:
validationErrorsHandler
- a callback that is used to handle validation errors- See Also:
-
Editor.setBuffered(boolean)
-