This commit is contained in:
KONE SOREL 2026-03-05 19:15:05 +00:00
parent 44d8d84252
commit e721ede4dd
2 changed files with 10 additions and 14 deletions

View File

@ -91660,35 +91660,32 @@ function loadMessageSection(section) {
}
function initSmartTable(selector, pageTitle) {
if ($(selector).length === 0) return;
function initSmartTable(selector, pageTitle = 'Export') {
if (!$(selector).length) return;
// Destruction de l'instance existante pour éviter les conflits Ajax
// Destruction de l'instance si elle existe déjà (évite les erreurs 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>',
return $(selector).DataTable({
// 'B' = Buttons, 'f' = filter, 'r' = processing, 't' = table, 'i' = info, 'p' = pagination
"dom": 'Bfrtip',
"buttons": [
{
extend: 'excelHtml5',
text: '<i class="fas fa-file-excel me-2"></i>Excel',
className: 'btn btn-success btn-sm fw-bold border-0 shadow-sm px-3 me-2'
className: 'btn btn-success btn-sm'
},
{
extend: 'pdfHtml5',
text: '<i class="fas fa-file-pdf me-2"></i>PDF',
className: 'btn btn-danger btn-sm fw-bold border-0 shadow-sm px-3',
className: 'btn btn-danger btn-sm',
title: pageTitle
}
],
"language": {
"url": "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json",
"search": "",
"searchPlaceholder": "Rechercher..."
},
"responsive": true,
"autoWidth": false
"url": "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json"
}
});
}

View File

@ -69,7 +69,6 @@ $descriptionVue = $_SESSION['descriptionVue'];
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.4.1/css/buttons.bootstrap5.min.css">
<link href="Bootstrap_new/css/select2.min.css" rel="stylesheet">
<link href="Bootstrap_new/select/css/bootstrap-select.min.css" rel="stylesheet">