Correction DataTable
This commit is contained in:
parent
89e62bbe2b
commit
730b94ebe4
100
Js/fonctions.js
100
Js/fonctions.js
|
|
@ -379,61 +379,57 @@ function appliquerDataTable() {
|
||||||
const $table = $('.tabliste');
|
const $table = $('.tabliste');
|
||||||
const codeLangue = $("#codeLangue").val();
|
const codeLangue = $("#codeLangue").val();
|
||||||
|
|
||||||
// Détruire l'instance existante si elle existe
|
// Dictionnaire des traductions
|
||||||
if ($.fn.DataTable.isDataTable($table)) {
|
const translations = {
|
||||||
$table.DataTable().destroy();
|
en_US: {
|
||||||
$table.empty(); // Optionnel
|
lengthMenu: "Display _MENU_ records per page",
|
||||||
}
|
zeroRecords: "Nothing found - sorry",
|
||||||
|
info: "Showing page _PAGE_ of _PAGES_",
|
||||||
|
infoEmpty: "No records available",
|
||||||
|
search: "Search:",
|
||||||
|
paginate: {
|
||||||
|
next: "►",
|
||||||
|
previous: "◄",
|
||||||
|
first: "|◄",
|
||||||
|
last: "►|"
|
||||||
|
},
|
||||||
|
infoFiltered: "(filtered from _MAX_ total records)"
|
||||||
|
},
|
||||||
|
fr_FR: {
|
||||||
|
lengthMenu: "Affiche _MENU_ par page",
|
||||||
|
zeroRecords: "Désolé - Aucune donnée trouvée",
|
||||||
|
info: "_PAGE_ sur _PAGES_ pages",
|
||||||
|
infoEmpty: "Pas d'enregistrement",
|
||||||
|
search: "Recherche:",
|
||||||
|
paginate: {
|
||||||
|
next: "►",
|
||||||
|
previous: "◄",
|
||||||
|
first: "|◄",
|
||||||
|
last: "►|"
|
||||||
|
},
|
||||||
|
infoFiltered: "(filtré de _MAX_ total enregistrements)"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Options DataTable
|
||||||
|
const options = {
|
||||||
|
destroy: true,
|
||||||
|
responsive: true,
|
||||||
|
order: [[0, "desc"]],
|
||||||
|
lengthMenu: [50, 100, 150],
|
||||||
|
pagingType: "full_numbers",
|
||||||
|
autoWidth: false,
|
||||||
|
language: translations[codeLangue] || translations.fr_FR
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Dictionnaire des traductions
|
// Initialisation
|
||||||
const translations = {
|
const instance = $table.DataTable(options);
|
||||||
en_US: {
|
|
||||||
lengthMenu: "Display _MENU_ records per page",
|
|
||||||
zeroRecords: "Nothing found - sorry",
|
|
||||||
info: "Showing page _PAGE_ of _PAGES_",
|
|
||||||
infoEmpty: "No records available",
|
|
||||||
search: "Search:",
|
|
||||||
paginate: {
|
|
||||||
next: "►",
|
|
||||||
previous: "◄",
|
|
||||||
first: "|◄",
|
|
||||||
last: "►|"
|
|
||||||
},
|
|
||||||
infoFiltered: "(filtered from _MAX_ total records)"
|
|
||||||
},
|
|
||||||
fr_FR: {
|
|
||||||
lengthMenu: "Affiche _MENU_ par page",
|
|
||||||
zeroRecords: "Désolé - Aucune donnée trouvée",
|
|
||||||
info: "_PAGE_ sur _PAGES_ pages",
|
|
||||||
infoEmpty: "Pas d'enregistrement",
|
|
||||||
search: "Recherche:",
|
|
||||||
paginate: {
|
|
||||||
next: "►",
|
|
||||||
previous: "◄",
|
|
||||||
first: "|◄",
|
|
||||||
last: "►|"
|
|
||||||
},
|
|
||||||
infoFiltered: "(filtré de _MAX_ total enregistrements)"
|
|
||||||
}
|
|
||||||
// ➕ Tu peux ajouter d'autres langues ici (ex: es_ES, de_DE, etc.)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Options communes
|
// Correction d'alignement après le rendu
|
||||||
const options = {
|
setTimeout(() => {
|
||||||
destroy: true,
|
instance.columns.adjust().responsive.recalc();
|
||||||
responsive: true,
|
}, 100);
|
||||||
order: [[0, "desc"]],
|
|
||||||
lengthMenu: [50, 100, 150],
|
|
||||||
scrollX: true,
|
|
||||||
scrollY: "75vh",
|
|
||||||
pagingType: "full_numbers",
|
|
||||||
autoWidth: false,
|
|
||||||
language: translations[codeLangue] || translations.fr_FR
|
|
||||||
};
|
|
||||||
|
|
||||||
// Initialisation du DataTable
|
|
||||||
$table.DataTable(options);
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Erreur lors de l'application du DataTable :", err);
|
console.error("Erreur lors de l'application du DataTable :", err);
|
||||||
|
|
|
||||||
|
|
@ -75,24 +75,23 @@
|
||||||
<i class="accordion-icon bi bi-chevron-down"></i>
|
<i class="accordion-icon bi bi-chevron-down"></i>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="accordion-content">
|
<div class="accordion-content">
|
||||||
<div class="tab-container">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-bordered table-hover table-condensed table-responsive tabliste compact" style="font-size:10pt; white-space:nowrap;">
|
<table class="table table-striped table-bordered table-hover table-condensed tabliste compact w-100" style="font-size:10pt; white-space:nowrap;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style='text-align:center'> <?= _("No Police") ?> </th>
|
<th style="text-align:center"> <?= _("No Police") ?> </th>
|
||||||
<th style='text-align:center'> <?= _("ID Police") ?> </th>
|
<th style="text-align:center"> <?= _("ID Police") ?> </th>
|
||||||
|
<th style="text-align:center">Type</th>
|
||||||
<th style='text-align:center'>Type</th>
|
<th style="text-align:center"> <?= _("Effet") ?> </th>
|
||||||
<th style='text-align:center'> <?= _("Effet") ?> </th>
|
<th style="text-align:center"> <?= _("Échéance") ?> </th>
|
||||||
<th style='text-align:center'> <?= _("Echéance") ?> </th>
|
<th style="text-align:center"> <?= _("Type Avenant") ?> </th>
|
||||||
|
<th style="text-align:center"> <?= _("État") ?> </th>
|
||||||
<th style='text-align:center'> <?= _("Type Avenant") ?> </th>
|
<th style="text-align:center"> <?= _("Prime") ?> </th>
|
||||||
<th style='text-align:center'> <?= _("Etat") ?> </th>
|
<th style="text-align:center"> <?= _("Sinistres") ?> </th>
|
||||||
<th style='text-align:center'> <?= _("Prime") ?> </th>
|
<th style="text-align:center"> <?= _("R S/P") ?> </th>
|
||||||
<th style='text-align:center'> <?= _("Sinitres") ?> </th>
|
</tr>
|
||||||
<th style='text-align:center'> <?= _("R S/P") ?> </th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($polices as $police):
|
<?php foreach ($polices as $police):
|
||||||
$id = $this->nettoyer($police['idPolice']);
|
$id = $this->nettoyer($police['idPolice']);
|
||||||
|
|
|
||||||
|
|
@ -594,7 +594,7 @@ console.groupEnd();
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
|
||||||
<!-- Application Scripts -->
|
<!-- Application Scripts -->
|
||||||
<script src="/Js/fonctions.js?ver=2025.12.25.00"></script>
|
<script src="/Js/fonctions.js?ver=2025.12.25.01"></script>
|
||||||
|
|
||||||
<?php if (est_anglophone()): ?>
|
<?php if (est_anglophone()): ?>
|
||||||
<script src="/Js/datepicker-eng.js"></script>
|
<script src="/Js/datepicker-eng.js"></script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user