From 8c11cc6c9210e41b1e9981a04e56dd59d462da91 Mon Sep 17 00:00:00 2001 From: Tarek Oraby <42799254+tarekoraby@users.noreply.github.com> Date: Wed, 28 Apr 2021 17:47:32 +0300 Subject: Fix validation in non-buffered Grid editor (#12281) Handle possible race condition by disabling the editor's widget while awaiting validation from the server. Fixes #12270 --- .../java/com/vaadin/shared/ui/grid/editor/EditorClientRpc.java | 9 +++++++++ .../java/com/vaadin/shared/ui/grid/editor/EditorServerRpc.java | 7 +++++++ 2 files changed, 16 insertions(+) (limited to 'shared') diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorClientRpc.java b/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorClientRpc.java index ce0499e0f6..356ac1a949 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorClientRpc.java +++ b/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorClientRpc.java @@ -70,4 +70,13 @@ public interface EditorClientRpc extends ClientRpc { * */ void setErrorMessage(String errorMessage, List errorColumnsIds); + + /** + * Confirms whether the binder's validation has passed so as to determine + * whether to allow the pending navigation action. + * + * @param isValid + * {@code true} if the binder value is valid + */ + void confirmValidity(boolean isValid); } diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorServerRpc.java b/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorServerRpc.java index e88e365eb1..4de49f25ba 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorServerRpc.java +++ b/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorServerRpc.java @@ -53,4 +53,11 @@ public interface EditorServerRpc extends ServerRpc { * after save action, otherwise it represents a cancel action */ void cancel(boolean afterBeingSaved); + + /** + * Asks the server to check the validity of the current values in the + * editor. When a check-validity request is sent, the server must respond + * with a {@link EditorClientRpc#confirmValidity(boolean) confirm call}. + */ + void checkValidity(); } -- cgit v1.2.3