diff --git a/Js/fonctions.js b/Js/fonctions.js index 94169ad..07b5ff1 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -52,7 +52,12 @@ function connexion_cookie() { $(function() { // 1. Initialisation des composants au chargement de la page - appliquerDataTable(); + appliquerDataTable('#claimsTable', { + order: [[1, "asc"]], // tri sur la 2e colonne + buttons: ['excel', 'pdf'], // seulement export Excel et PDF + pageLength: 25 // 25 lignes par page + }); + // 2. Lancement du cycle de rafraîchissement automatique const vueActuelle = $("#vue").val(); @@ -83,7 +88,7 @@ function raffraichier_gabarit() { success: function(data) { // Injection du nouveau contenu debugger; - + $("#div_ajaxgabarit").html(data); const codeSociete = $("#codeSociete").val(); @@ -325,10 +330,14 @@ function changer_langue_connexion() { /** * CONFIGURATION DATATABLES - * Initialise les tableaux avec exports, filtres et traductions. + * Initialise un tableau DataTable avec options génériques. + * + * @param {string|jQuery} selector - Sélecteur du tableau (ex: '.tabliste' ou '#myTable') + * @param {object} options - Options personnalisées (langue, boutons, ordre, etc.) */ -function appliquerDataTable() { +function appliquerDataTable(selector = '.tabliste', options = {}) { const codeLangue = $("#codeLangue").val() || 'fr_FR'; + const translations = { fr_FR: { lengthMenu: "Affiche _MENU_ par page", @@ -346,15 +355,16 @@ function appliquerDataTable() { } }; - $('.tabliste').each(function() { + $(selector).each(function() { const $table = $(this); - // On récupère les colonnes marquées comme 'data-hidden' + + // Colonnes marquées comme 'data-hidden' const hiddenTargets = []; $table.find('thead th').each((idx, th) => { if ($(th).data('hidden')) hiddenTargets.push(idx); }); - const instance = $table.DataTable({ + const instance = $table.DataTable($.extend(true, { destroy: true, responsive: true, order: [[0, "desc"]], @@ -362,10 +372,15 @@ function appliquerDataTable() { columnDefs: [{ targets: hiddenTargets, visible: false }], dom: 'Bfrtip', buttons: ['copy', 'csv', 'excel', 'pdf', 'print'] - }); + }, options)); - // Ajustement forcé après rendu pour éviter les problèmes de colonnes mal alignées - setTimeout(() => instance.columns.adjust().responsive.recalc(), 100); + // Ajustement après rendu + $table.on('init.dt', function () { + if (instance && instance.responsive) { + instance.columns.adjust(); + instance.responsive.recalc(); + } + }); }); } diff --git a/Vue/gabarit.php b/Vue/gabarit.php index e420158..f57bdc2 100755 --- a/Vue/gabarit.php +++ b/Vue/gabarit.php @@ -616,7 +616,7 @@ console.groupEnd(); - + diff --git a/manifest.json b/manifest.json index 5709ef2..4daa679 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "icons": [ { "src": "/Bootstrap_new/images/new/favicon.png", - "sizes": "72x72 96x96 128x128 144x144 152x152 192x192 384x384 512x512", + "sizes": "48x48 72x72 96x96 128x128 144x144 152x152 192x192 384x384 512x512", "type": "image/png", "purpose": "any maskable" },