Correction des erreurs dans console

This commit is contained in:
KONE SOREL 2025-12-26 12:37:54 +00:00
parent bb125ffb6c
commit c6f3128faf
3 changed files with 27 additions and 12 deletions

View File

@ -52,7 +52,12 @@ function connexion_cookie() {
$(function() {
// 1. Initialisation des composants au chargement de la page
appliquerDataTable();
appliquerDataTable('#claimsTable', {
order: [[1, "asc"]], // tri sur la 2e colonne
buttons: ['excel', 'pdf'], // seulement export Excel et PDF
pageLength: 25 // 25 lignes par page
});
// 2. Lancement du cycle de rafraîchissement automatique
const vueActuelle = $("#vue").val();
@ -325,10 +330,14 @@ function changer_langue_connexion() {
/**
* CONFIGURATION DATATABLES
* Initialise les tableaux avec exports, filtres et traductions.
* Initialise un tableau DataTable avec options génériques.
*
* @param {string|jQuery} selector - Sélecteur du tableau (ex: '.tabliste' ou '#myTable')
* @param {object} options - Options personnalisées (langue, boutons, ordre, etc.)
*/
function appliquerDataTable() {
function appliquerDataTable(selector = '.tabliste', options = {}) {
const codeLangue = $("#codeLangue").val() || 'fr_FR';
const translations = {
fr_FR: {
lengthMenu: "Affiche _MENU_ par page",
@ -346,15 +355,16 @@ function appliquerDataTable() {
}
};
$('.tabliste').each(function() {
$(selector).each(function() {
const $table = $(this);
// On récupère les colonnes marquées comme 'data-hidden'
// Colonnes marquées comme 'data-hidden'
const hiddenTargets = [];
$table.find('thead th').each((idx, th) => {
if ($(th).data('hidden')) hiddenTargets.push(idx);
});
const instance = $table.DataTable({
const instance = $table.DataTable($.extend(true, {
destroy: true,
responsive: true,
order: [[0, "desc"]],
@ -362,10 +372,15 @@ function appliquerDataTable() {
columnDefs: [{ targets: hiddenTargets, visible: false }],
dom: 'Bfrtip',
buttons: ['copy', 'csv', 'excel', 'pdf', 'print']
});
}, options));
// Ajustement forcé après rendu pour éviter les problèmes de colonnes mal alignées
setTimeout(() => instance.columns.adjust().responsive.recalc(), 100);
// Ajustement après rendu
$table.on('init.dt', function () {
if (instance && instance.responsive) {
instance.columns.adjust();
instance.responsive.recalc();
}
});
});
}

View File

@ -616,7 +616,7 @@ console.groupEnd();
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- Application Scripts -->
<script src="/Js/fonctions.js?ver=2025.12.25.06"></script>
<script src="/Js/fonctions.js?ver=2025.12.25.07"></script>
<?php if (est_anglophone()): ?>
<script src="/Js/datepicker-eng.js"></script>

View File

@ -14,7 +14,7 @@
"icons": [
{
"src": "/Bootstrap_new/images/new/favicon.png",
"sizes": "72x72 96x96 128x128 144x144 152x152 192x192 384x384 512x512",
"sizes": "48x48 72x72 96x96 128x128 144x144 152x152 192x192 384x384 512x512",
"type": "image/png",
"purpose": "any maskable"
},