df
This commit is contained in:
parent
607956a68c
commit
44d8d84252
|
|
@ -91623,20 +91623,35 @@ function ui_refresh_select(selector) {
|
|||
function loadMessageSection(section) {
|
||||
let url = "";
|
||||
let target = "#content-" + section;
|
||||
let donnees = "";
|
||||
let donnees = "";
|
||||
|
||||
// Détermination de l'ID du tableau et du titre pour l'export
|
||||
let tableId = (section === 'Motifs') ? '#tableMotifs' : '#tableTextes';
|
||||
let pageTitle = (section === 'Motifs') ? 'Liste des Motifs de Dépassement' : 'Liste des Textes de Facturation';
|
||||
|
||||
if (section === 'Motifs') url = $("#racineWeb").val() + "Ajaxmotifdepassement/";
|
||||
if (section === 'Facturation') url = $("#racineWeb").val() + "Ajaxtextefacturationgarant/";
|
||||
|
||||
// Éviter de recharger si déjà chargé (optionnel)
|
||||
if ($(target).find('table').length > 0) return;
|
||||
// Si déjà chargé, on ajuste simplement les colonnes pour le rendu visuel
|
||||
if ($(target).find('table').length > 0) {
|
||||
if ($.fn.DataTable.isDataTable(tableId)) {
|
||||
$(tableId).DataTable().columns.adjust();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'post',
|
||||
data: donnees,
|
||||
data: donnees,
|
||||
success: function(data) {
|
||||
// 1. Injection du contenu HTML
|
||||
$(target).html(data);
|
||||
|
||||
// 2. Initialisation forcée avec un léger délai pour laisser le DOM respirer
|
||||
setTimeout(function() {
|
||||
initSmartTable(tableId, pageTitle);
|
||||
}, 150);
|
||||
},
|
||||
error: function() {
|
||||
$(target).html('<div class="alert alert-danger m-3">Erreur de chargement</div>');
|
||||
|
|
@ -91644,10 +91659,16 @@ function loadMessageSection(section) {
|
|||
});
|
||||
}
|
||||
|
||||
function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Données') {
|
||||
|
||||
function initSmartTable(selector, pageTitle) {
|
||||
if ($(selector).length === 0) return;
|
||||
|
||||
return $(selector).DataTable({
|
||||
// Destruction de l'instance existante pour éviter les conflits 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>',
|
||||
"buttons": [
|
||||
{
|
||||
|
|
@ -91659,9 +91680,7 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn
|
|||
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',
|
||||
title: pageTitle,
|
||||
orientation: 'landscape',
|
||||
pageSize: 'A4'
|
||||
title: pageTitle
|
||||
}
|
||||
],
|
||||
"language": {
|
||||
|
|
@ -91669,11 +91688,7 @@ function initSmartTable(selector = '.datatable-inter', pageTitle = 'Export Donn
|
|||
"search": "",
|
||||
"searchPlaceholder": "Rechercher..."
|
||||
},
|
||||
"pageLength": 10,
|
||||
"drawCallback": function() {
|
||||
// Style dynamique de la barre de recherche
|
||||
$('.dataTables_filter input').addClass('form-control form-control-sm rounded-pill border-2 ps-3 shadow-none');
|
||||
$('.dataTables_paginate .paginate_button').addClass('btn btn-xs mx-1');
|
||||
}
|
||||
"responsive": true,
|
||||
"autoWidth": false
|
||||
});
|
||||
}
|
||||
|
|
@ -29,8 +29,3 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
initSmartTable('#tableMotifs', 'Liste des Motifs de Dépassement');
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -35,9 +35,3 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
initSmartTable('#tableTextes', 'Liste des Textes sur facture');
|
||||
});
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user