This commit is contained in:
KONE SOREL 2026-03-05 19:47:04 +00:00
parent 46e6a8b417
commit 11c231c99c
2 changed files with 32 additions and 13 deletions

View File

@ -1435,9 +1435,18 @@ select[class*="selectpicker"],
opacity: 0.8;
}
.dt-buttons-custom {
margin-right: 15px;
/* S'assurer que le titre "Rechercher :" est aligné avec son input */
.dataTables_filter label {
display: flex;
align-items: center;
margin-bottom: 0;
font-weight: 600;
color: var(--text-dark);
}
.dt-search-custom input {
min-width: 200px;
/* Espacement entre les boutons export */
.dt-buttons {
display: flex;
align-items: center;
}

View File

@ -91659,32 +91659,42 @@ function loadMessageSection(section) {
});
}
function initSmartTable(selector, pageTitle = 'Export') {
if (!$(selector).length) return;
function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Données') {
if ($(selector).length === 0) return;
// Destruction de l'instance si elle existe déjà (évite les erreurs Ajax)
if ($.fn.DataTable.isDataTable(selector)) {
$(selector).DataTable().destroy();
}
return $(selector).DataTable({
// 'B' = Buttons, 'f' = filter, 'r' = processing, 't' = table, 'i' = info, 'p' = pagination
"dom": 'Bfrtip',
// 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: '<i class="fas fa-file-excel me-2"></i>Excel',
className: 'btn btn-success btn-sm'
className: 'btn btn-success btn-sm fw-bold border-0 shadow-sm px-3'
},
{
extend: 'pdfHtml5',
text: '<i class="fas fa-file-pdf me-2"></i>PDF',
className: 'btn btn-danger btn-sm',
title: pageTitle
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"
"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');
}
});
}