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