This commit is contained in:
KONE SOREL 2026-03-06 09:03:49 +00:00
parent 97a7def0ce
commit a8d56ffa39
3 changed files with 54 additions and 22 deletions

View File

@ -91659,6 +91659,7 @@ function loadMessageSection(section) {
});
}
/*
function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Données') {
if ($(selector).length === 0) return;
@ -91697,4 +91698,41 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn
$('.dataTables_paginate .paginate_button').addClass('btn btn-xs mx-1');
}
});
}
*/
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>',
"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'
},
{
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 ms-2',
title: pageTitle,
orientation: 'landscape',
pageSize: 'A4'
}
],
"language": {
"url": "//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json"
},
"pageLength": 10,
"autoWidth": false,
"drawCallback": function() {
$('.dataTables_paginate .paginate_button').addClass('btn btn-xs mx-1');
}
});
}

View File

@ -70,17 +70,14 @@
</div>
<script>
// RECHERCHE RAPIDE VANILLA JS
document.addEventListener("DOMContentLoaded", function() {
const searchInput = document.getElementById('globalSearch');
if (searchInput) {
searchInput.addEventListener('keyup', function() {
const filter = this.value.toLowerCase();
document.querySelectorAll('.searchable-row').forEach(row => {
row.style.display = row.textContent.toLowerCase().includes(filter) ? "" : "none";
});
});
}
$(document).ready(function() {
// Initialisation
var tableBons = initSmartTable('.table', 'Gestion des Bons');
// Liaison du champ de recherche personnalisé
$('#globalSearch').on('keyup', function() {
tableBons.search(this.value).draw();
});
});
</script>

View File

@ -92,17 +92,14 @@
</div>
<script>
// RECHERCHE RAPIDE VANILLA JS
document.addEventListener("DOMContentLoaded", function() {
const searchInput = document.getElementById('globalSearch');
if (searchInput) {
searchInput.addEventListener('keyup', function() {
const filter = this.value.toLowerCase();
document.querySelectorAll('.searchable-row').forEach(row => {
row.style.display = row.textContent.toLowerCase().includes(filter) ? "" : "none";
});
});
}
$(document).ready(function() {
// Initialisation
var tableLiens = initSmartTable('.table', 'Gestion des Liens de Parenté');
// Liaison du champ de recherche personnalisé
$('#globalSearch').on('keyup', function() {
tableLiens.search(this.value).draw();
});
});
</script>