This commit is contained in:
KONE SOREL 2026-03-11 17:36:27 +00:00
parent 3220513705
commit cbabc81a9e

View File

@ -47467,7 +47467,8 @@ function medecinsprestataire()
*******************************************************************/ *******************************************************************/
function chargerFichiersTable() { function chargerFichiersTable() {
const idTable = $('#listetables').val(); const $select = $('#listetables');
const idTable = $select.val();
const racineWeb = $("#racineWeb").val(); const racineWeb = $("#racineWeb").val();
const codeLangue = $("#codeLangue").val(); const codeLangue = $("#codeLangue").val();
@ -47476,8 +47477,11 @@ function chargerFichiersTable() {
return; return;
} }
// Feedback visuel // --- FIX ANTI-ACCUMULATION ---
const loadingHtml = `...`; // On récupère le texte propre AVANT l'AJAX
const selectedText = $select.find('option:selected').text().trim();
const loadingHtml = `<div class="text-center p-3"><div class="spinner-border spinner-border-sm text-primary"></div></div>`;
$('#div_lister_table').html(loadingHtml); $('#div_lister_table').html(loadingHtml);
$('#div_maj_table').html(""); $('#div_maj_table').html("");
@ -47490,9 +47494,15 @@ function chargerFichiersTable() {
$('#div_fichiers_table').html(data); $('#div_fichiers_table').html(data);
afficheDonneesTableChoisie($('#fichier_lister').val()); afficheDonneesTableChoisie($('#fichier_lister').val());
// --- CORRECTION ICI --- // --- CORRECTION NEUTRAL PRO ---
// On force le SelectPicker à se rafraîchir pour ne pas perdre le design // 1. On rafraîchit le picker pour l'état interne
$('#listetables').selectpicker('refresh'); $select.selectpicker('refresh');
// 2. On FORCE le texte du bouton à redevenir unique
// On cible précisément la div interne de rendu de Bootstrap-Select
$('.bootstrap-select .filter-option-inner-inner').each(function() {
$(this).text(selectedText);
});
}, },
error: function(xhr) { error: function(xhr) {
toastr.error((codeLangue === "en_US") ? "Error..." : "Erreur..."); toastr.error((codeLangue === "en_US") ? "Error..." : "Erreur...");
@ -48120,45 +48130,39 @@ function filtreTableReference(numeroTable) {
const racineWeb = $("#racineWeb").val(); const racineWeb = $("#racineWeb").val();
const $divListe = $("#div_listetables"); const $divListe = $("#div_listetables");
// 1. ÉTAPE CRUCIALE : On détruit l'instance ET on vide physiquement le conteneur // 1. On tue l'existant et on vide le BODY des menus flottants
// pour supprimer les boutons et menus générés précédemment par le plugin
if ($("#listetables").length) { if ($("#listetables").length) {
$("#listetables").selectpicker('destroy'); $("#listetables").selectpicker('destroy');
} }
// On nettoie aussi les menus détachés dans le body (si container: 'body' était utilisé)
$('.bootstrap-select.bs-container').remove(); $('.bootstrap-select.bs-container').remove();
$divListe.empty();
// On vide le conteneur HTML pour repartir sur une base 100% neuve
$divListe.empty().html('<div class="spinner-border spinner-border-sm text-primary"></div>');
$.ajax({ $.ajax({
url: racineWeb + "Ajaxfiltretablesreference/", url: racineWeb + "Ajaxfiltretablesreference/",
type : 'post', type : 'post',
data: { numeroTable: numeroTable }, data: { numeroTable: numeroTable },
success: function(data) { success: function(data) {
// 2. On injecte le nouveau <select> (sans la classe selectpicker dans le PHP) // 2. On injecte le HTML
$divListe.html(data); $divListe.html(data);
const $select = $("#listetables"); const $select = $("#listetables");
// 3. Initialisation "propre" // 3. Initialisation forcée
// On s'assure que l'élément est prêt avant d'initialiser
setTimeout(function() { setTimeout(function() {
$select.selectpicker({ $select.selectpicker({
liveSearch: true, liveSearch: true,
size: 10,
container: 'body', container: 'body',
width: '100%', width: '100%',
style: 'btn-form-select' style: 'btn-form-select',
noneSelectedText: '-- Sélectionner --'
}); });
// Forcer la valeur à vide au début pour éviter l'accumulation visuelle
$select.selectpicker('val', '');
$select.selectpicker('refresh');
// --- LE FIX RADICAL ---
// On force le nettoyage du texte du bouton pour supprimer les accumulations
const initialText = $select.find('option:selected').text() || '-- Sélectionner --';
$divListe.find('.filter-option-inner-inner').text(initialText);
$divListe.find('.dropdown-toggle').focus(); $divListe.find('.dropdown-toggle').focus();
}, 100); }, 150);
} }
}); });
} }