aboutsummaryrefslogtreecommitdiffstats
path: root/shared/src/main
diff options
context:
space:
mode:
authorTarek Oraby <42799254+tarekoraby@users.noreply.github.com>2021-04-28 17:47:32 +0300
committerGitHub <noreply@github.com>2021-04-28 17:47:32 +0300
commit8c11cc6c9210e41b1e9981a04e56dd59d462da91 (patch)
tree9bcbfcf705f3217621144e2b951814401617139f /shared/src/main
parent83ee08eae1a9997298713a6302dc929cc98dedfc (diff)
downloadvaadin-framework-8c11cc6c9210e41b1e9981a04e56dd59d462da91.tar.gz
vaadin-framework-8c11cc6c9210e41b1e9981a04e56dd59d462da91.zip
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
Diffstat (limited to 'shared/src/main')
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorClientRpc.java9
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorServerRpc.java7
2 files changed, 16 insertions, 0 deletions
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<String> 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();
}