From 44d8d8425230d80c0761be78f57d556b4f040880 Mon Sep 17 00:00:00 2001 From: KONE SOREL Date: Thu, 5 Mar 2026 18:46:45 +0000 Subject: [PATCH] df --- Js/fonctions.js | 45 ++++++++++++++++-------- Vue/Ajaxmotifdepassement/index.php | 5 --- Vue/Ajaxtextefacturationgarant/index.php | 6 ---- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/Js/fonctions.js b/Js/fonctions.js index 61609652..025ce17c 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -91623,20 +91623,35 @@ function ui_refresh_select(selector) { function loadMessageSection(section) { let url = ""; let target = "#content-" + section; - let donnees = ""; + let donnees = ""; + + // Détermination de l'ID du tableau et du titre pour l'export + let tableId = (section === 'Motifs') ? '#tableMotifs' : '#tableTextes'; + let pageTitle = (section === 'Motifs') ? 'Liste des Motifs de Dépassement' : 'Liste des Textes de Facturation'; if (section === 'Motifs') url = $("#racineWeb").val() + "Ajaxmotifdepassement/"; if (section === 'Facturation') url = $("#racineWeb").val() + "Ajaxtextefacturationgarant/"; - // Éviter de recharger si déjà chargé (optionnel) - if ($(target).find('table').length > 0) return; + // Si déjà chargé, on ajuste simplement les colonnes pour le rendu visuel + if ($(target).find('table').length > 0) { + if ($.fn.DataTable.isDataTable(tableId)) { + $(tableId).DataTable().columns.adjust(); + } + return; + } $.ajax({ url: url, type: 'post', - data: donnees, + data: donnees, success: function(data) { + // 1. Injection du contenu HTML $(target).html(data); + + // 2. Initialisation forcée avec un léger délai pour laisser le DOM respirer + setTimeout(function() { + initSmartTable(tableId, pageTitle); + }, 150); }, error: function() { $(target).html('
Erreur de chargement
'); @@ -91644,10 +91659,16 @@ function loadMessageSection(section) { }); } -function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Données') { + +function initSmartTable(selector, pageTitle) { if ($(selector).length === 0) return; - return $(selector).DataTable({ + // Destruction de l'instance existante pour éviter les conflits Ajax + if ($.fn.DataTable.isDataTable(selector)) { + $(selector).DataTable().destroy(); + } + + $(selector).DataTable({ "dom": '<"d-flex justify-content-between align-items-center p-3 border-bottom"<"dt-buttons-custom"B><"dt-search-custom"f>>t<"d-flex justify-content-between align-items-center p-3 bg-light"ip>', "buttons": [ { @@ -91659,9 +91680,7 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-danger btn-sm fw-bold border-0 shadow-sm px-3', - title: pageTitle, - orientation: 'landscape', - pageSize: 'A4' + title: pageTitle } ], "language": { @@ -91669,11 +91688,7 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn "search": "", "searchPlaceholder": "Rechercher..." }, - "pageLength": 10, - "drawCallback": function() { - // Style dynamique de la barre de recherche - $('.dataTables_filter input').addClass('form-control form-control-sm rounded-pill border-2 ps-3 shadow-none'); - $('.dataTables_paginate .paginate_button').addClass('btn btn-xs mx-1'); - } + "responsive": true, + "autoWidth": false }); } \ No newline at end of file diff --git a/Vue/Ajaxmotifdepassement/index.php b/Vue/Ajaxmotifdepassement/index.php index b1d75eee..6bd3e558 100755 --- a/Vue/Ajaxmotifdepassement/index.php +++ b/Vue/Ajaxmotifdepassement/index.php @@ -29,8 +29,3 @@ - diff --git a/Vue/Ajaxtextefacturationgarant/index.php b/Vue/Ajaxtextefacturationgarant/index.php index 00821da4..e982a502 100755 --- a/Vue/Ajaxtextefacturationgarant/index.php +++ b/Vue/Ajaxtextefacturationgarant/index.php @@ -35,9 +35,3 @@ - - \ No newline at end of file