From a108c28072d3c46fd1d89d8daef7650e29e71ef6 Mon Sep 17 00:00:00 2001
From: Emmanuel Viennet <emmanuel.viennet@gmail.com>
Date: Thu, 6 Feb 2025 14:37:46 +0100
Subject: [PATCH] =?UTF-8?q?Front:=20dataTables:=20recap.:=20lib=C3=A8re=20?=
 =?UTF-8?q?colonnes=20droite=20+=20ajouste=20largeurs=20colonnes.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/static/js/table_recap.js | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/app/static/js/table_recap.js b/app/static/js/table_recap.js
index 6bfa63aa..bcad68c1 100644
--- a/app/static/js/table_recap.js
+++ b/app/static/js/table_recap.js
@@ -74,11 +74,8 @@ $(function () {
       toggle_col_group_visibility(dt, "col_malus", onoff);
     }
     function toggle_col_group_visibility(dt, group, onoff) {
-      if (onoff) {
-        dt.columns("." + group).visible(false);
-      } else {
-        dt.columns("." + group).visible(true);
-      }
+      dt.columns("." + group).visible(!onoff, false);
+      dt.columns.adjust();
       update_buttons_labels(dt);
     }
     // Definition des boutons au dessus de la table:
@@ -203,11 +200,17 @@ $(function () {
         info: false,
         autoWidth: false,
         scrollX: true,
-        fixedColumns: { // fige les 3 colonnes de gauche
-           start: 3
-        },
+        // fixedColumns: { // fige les 3 colonnes de gauche
+        //    start: 3
+        // },
+        // provoque trop de bugs d'affichage XXX
         initComplete: function (settings, json) {
-          // fixe la largeur de la table (évite décalages colonnes)
+            // fixe la largeur de la table (évite décalages colonnes) ??
+            document.querySelectorAll("table.dataTable").forEach((table) => {
+            table.style.width = document.querySelector(
+              "#DataTables_Table_0_wrapper .dt-scroll-head .dt-scroll-headInner"
+            ).style.width;
+            });
           document.getElementById("DataTables_Table_0").style.width =
             document.querySelector(
               "#DataTables_Table_0_wrapper .dt-scroll-head .dt-scroll-headInner"
-- 
GitLab