From fea207820166afb4dcf8945fe8a65dbe50456918 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 11 Dec 2021 18:52:43 +0100 Subject: [PATCH] Enregistrement des coefs quand on quitte le formulaire --- app/static/js/table_editor.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/static/js/table_editor.js b/app/static/js/table_editor.js index c1b9dd9f..837c404b 100644 --- a/app/static/js/table_editor.js +++ b/app/static/js/table_editor.js @@ -43,6 +43,14 @@ function installListeners() { document.querySelectorAll("[data-editable=true]").forEach(cellule => { cellule.addEventListener("click", function () { selectCell(this) }); cellule.addEventListener("dblclick", function () { modifCell(this) }); + cellule.addEventListener("blur", function () { + let currentModif = document.querySelector(".modifying"); + if (currentModif) { + if (!save(currentModif)) { + return; + } + } + }); }); }