drt
This commit is contained in:
parent
41502f271e
commit
300f2ddc31
|
|
@ -92285,10 +92285,10 @@ function enregistrer_modif_parametres_med()
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialise DataTables avec options d'export et de tri
|
||||
* Initialise DataTables avec options d'export et de tri (Version ESI Optimisée)
|
||||
* @param {string} selector - Sélecteur CSS de la table
|
||||
* @param {string} pageTitle - Titre pour les exports PDF/Excel
|
||||
* @param {boolean|array} defaultOrder - Exemple: [1, 'desc'] ou false pour garder l'ordre serveur
|
||||
* @param {boolean|array} defaultOrder - [1, 'desc'] ou false pour l'ordre serveur
|
||||
* @param {boolean} showButtons - Affiche ou masque les boutons d'export (Défaut: true)
|
||||
*/
|
||||
function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Données', defaultOrder = false, showButtons = true) {
|
||||
|
|
@ -92300,9 +92300,8 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn
|
|||
$(selector).DataTable().destroy();
|
||||
}
|
||||
|
||||
// Modification du DOM :
|
||||
// Si showButtons est false, on retire "B" (Buttons) de la structure
|
||||
// On utilise "ms-auto" pour pousser "f" (Filter) à droite même si "B" est absent
|
||||
// Structure du DOM : B=Buttons, f=Filter, t=Table, i=Info, p=Pagination
|
||||
// ms-auto pousse la recherche à l'extrême droite
|
||||
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 p-3 border-bottom"' + (showButtons ? 'B' : '') + '<"ms-auto"f>>t<"d-flex justify-content-between align-items-center p-3 bg-light"ip>';
|
||||
|
|
@ -92312,7 +92311,7 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn
|
|||
var table = $(selector).DataTable({
|
||||
"dom": domStructure,
|
||||
"order": orderConfig,
|
||||
// On n'active les boutons que si showButtons est à true
|
||||
"pagingType": "full_numbers", // Indispensable pour afficher First et Last
|
||||
"buttons": showButtons ? [
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
|
|
@ -92339,20 +92338,20 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn
|
|||
}
|
||||
] : [],
|
||||
"language": {
|
||||
"url": "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json",
|
||||
"search": "",
|
||||
"searchPlaceholder": "Rechercher...",
|
||||
// Surcharge des libellés de pagination après le chargement du fichier JSON
|
||||
"paginate": {
|
||||
"first": '<i class="fas fa-angle-double-left"></i>',
|
||||
"last": '<i class="fas fa-angle-double-right"></i>',
|
||||
"next": '<i class="fas fa-angle-right"></i>',
|
||||
"previous": '<i class="fas fa-angle-left"></i>'
|
||||
}
|
||||
},
|
||||
"url": "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json",
|
||||
"search": "",
|
||||
"searchPlaceholder": "Rechercher...",
|
||||
"paginate": {
|
||||
"first": '<i class="fas fa-angle-double-left"></i>',
|
||||
"last": '<i class="fas fa-angle-double-right"></i>',
|
||||
"next": '<i class="fas fa-angle-right"></i>',
|
||||
"previous": '<i class="fas fa-angle-left"></i>'
|
||||
}
|
||||
},
|
||||
"pageLength": 10,
|
||||
"autoWidth": false,
|
||||
"drawCallback": function() {
|
||||
// Style de l'input de recherche (si pas de recherche globale)
|
||||
if (!hasGlobalSearch) {
|
||||
$('.dataTables_filter input')
|
||||
.addClass('form-control form-control-sm shadow-none border-primary-subtle')
|
||||
|
|
@ -92362,10 +92361,22 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn
|
|||
'padding-left': '15px'
|
||||
});
|
||||
}
|
||||
|
||||
// Style des boutons de pagination (btn-xs et marges)
|
||||
$('.dataTables_paginate .paginate_button').addClass('btn btn-xs mx-1');
|
||||
|
||||
// Correction visuelle : on s'assure que les icônes sont bien centrées
|
||||
$('.dataTables_paginate .paginate_button').css({
|
||||
'display': 'inline-flex',
|
||||
'align-items': 'center',
|
||||
'justify-content': 'center',
|
||||
'min-width': '30px',
|
||||
'height': '30px'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Gestion de la recherche globale si elle existe
|
||||
if (hasGlobalSearch) {
|
||||
$('#globalSearch').off('keyup').on('keyup', function() {
|
||||
table.search(this.value).draw();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user