diff --git a/Js/fonctions.js b/Js/fonctions.js index 5f0c3878..59649b27 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -91659,58 +91659,24 @@ function loadMessageSection(section) { }); } -/* function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Données') { if ($(selector).length === 0) return; + // Détection automatique : la barre de recherche personnalisée existe-t-elle ? + var hasGlobalSearch = $('#globalSearch').length > 0; + if ($.fn.DataTable.isDataTable(selector)) { $(selector).DataTable().destroy(); } - return $(selector).DataTable({ - // MODIFICATION : On utilise une seule ligne (div) pour les boutons et la recherche - "dom": '<"d-flex align-items-center justify-content-between p-3 border-bottom"Bf>t<"d-flex justify-content-between align-items-center p-3 bg-light"ip>', - "buttons": [ - { - extend: 'excelHtml5', - text: 'Excel', - className: 'btn btn-success btn-sm fw-bold border-0 shadow-sm px-3' - }, - { - extend: 'pdfHtml5', - text: 'PDF', - className: 'btn btn-danger btn-sm fw-bold border-0 shadow-sm px-3 ms-2', // Ajout d'une marge à gauche du bouton PDF - title: pageTitle, - orientation: 'landscape', - pageSize: 'A4' - } - ], - "language": { - "url": "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json", - "search": "Rechercher : ", - "searchPlaceholder": "Filtrer..." - }, - "pageLength": 10, - "autoWidth": false, - "drawCallback": function() { - // Style de la barre de recherche pour qu'elle ne soit pas trop collée - $('.dataTables_filter input').addClass('form-control form-control-sm d-inline-block ms-2 rounded-pill border-2 shadow-none').css('width', '200px'); - $('.dataTables_paginate .paginate_button').addClass('btn btn-xs mx-1'); - } - }); -} -*/ + // Configuration du DOM : + // Si hasGlobalSearch est vrai, on retire 'f' (recherche native) + var domStructure = hasGlobalSearch + ? '<"d-flex align-items-center justify-content-start p-3 border-bottom"B>t<"d-flex justify-content-between align-items-center p-3 bg-light"ip>' + : '<"d-flex align-items-center justify-content-between p-3 border-bottom"Bf>t<"d-flex justify-content-between align-items-center p-3 bg-light"ip>'; -function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Données') { - if ($(selector).length === 0) return; - - if ($.fn.DataTable.isDataTable(selector)) { - $(selector).DataTable().destroy(); - } - - return $(selector).DataTable({ - // MODIFICATION : On retire 'f' pour masquer la recherche native - "dom": '<"d-flex align-items-center justify-content-start p-3 border-bottom"B>t<"d-flex justify-content-between align-items-center p-3 bg-light"ip>', + var table = $(selector).DataTable({ + "dom": domStructure, "buttons": [ { extend: 'excelHtml5', @@ -91727,12 +91693,27 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn } ], "language": { - "url": "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json" + "url": "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json", + "search": "Rechercher : ", + "searchPlaceholder": "Filtrer..." }, "pageLength": 10, "autoWidth": false, "drawCallback": function() { + // Style uniquement si la recherche native est affichée + if (!hasGlobalSearch) { + $('.dataTables_filter input').addClass('form-control form-control-sm d-inline-block ms-2 rounded-pill border-2 shadow-none').css('width', '200px'); + } $('.dataTables_paginate .paginate_button').addClass('btn btn-xs mx-1'); } }); + + // LIAISON AUTOMATIQUE : Si globalSearch existe, on branche l'événement tout de suite + if (hasGlobalSearch) { + $('#globalSearch').off('keyup').on('keyup', function() { + table.search(this.value).draw(); + }); + } + + return table; } \ No newline at end of file diff --git a/Vue/Parambons/index.php b/Vue/Parambons/index.php index d1f94815..566c1bdf 100755 --- a/Vue/Parambons/index.php +++ b/Vue/Parambons/index.php @@ -70,17 +70,10 @@ diff --git a/Vue/Paramlienparente/index.php b/Vue/Paramlienparente/index.php index ae85d088..f7e73144 100755 --- a/Vue/Paramlienparente/index.php +++ b/Vue/Paramlienparente/index.php @@ -92,17 +92,10 @@