From 04335e521a28eb3a0e4ccdde048b85aa7ca5cbd1 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 7 Dec 2023 19:42:57 +0100 Subject: [PATCH] =?UTF-8?q?M=C3=A9morise=20chez=20le=20client=20l'=C3=A9ta?= =?UTF-8?q?t=20tri=20de=20toutes=20les=20gt=5Ftables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/assiduites.css | 3 ++- app/static/js/scodoc.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/static/css/assiduites.css b/app/static/css/assiduites.css index e331b3938..613797f9a 100644 --- a/app/static/css/assiduites.css +++ b/app/static/css/assiduites.css @@ -643,6 +643,7 @@ .assi-liste { border: 1px solid gray; border-radius: 12px; + margin-right: 12px; padding: 12px; } #options-tableau label { @@ -657,5 +658,5 @@ table.liste_assi td.date { width: 140px; } table.liste_assi td.actions { - width: 70px; + white-space: nowrap; /* boutons horizontalement */ } diff --git a/app/static/js/scodoc.js b/app/static/js/scodoc.js index d191cc4ad..4050ff689 100644 --- a/app/static/js/scodoc.js +++ b/app/static/js/scodoc.js @@ -156,6 +156,17 @@ function get_query_args() { // Tables (gen_tables) $(function () { if ($("table.gt_table").length > 0) { + const url = new URL(document.URL); + const order_info_key = JSON.stringify(["table_order", url.pathname]); + let order_info; + const x = localStorage.getItem(order_info_key); + if (x) { + try { + order_info = JSON.parse(x); + } catch (error) { + console.error(error); + } + } var table_options = { paging: false, searching: false, @@ -167,6 +178,13 @@ $(function () { }, orderCellsTop: true, // cellules ligne 1 pour tri aaSorting: [], // Prevent initial sorting + order: order_info, + drawCallback: function (settings) { + // permet de conserver l'ordre de tri des colonnes + let table = $("table.gt_table").DataTable(); + let order_info = JSON.stringify(table.order()); + localStorage.setItem(order_info_key, order_info); + }, }; $("table.gt_table").DataTable(table_options); table_options["searching"] = true;