df
This commit is contained in:
parent
c9616415a4
commit
e2dd9a085d
|
|
@ -48120,35 +48120,36 @@ function filtreTableReference(numeroTable) {
|
||||||
const racineWeb = $("#racineWeb").val();
|
const racineWeb = $("#racineWeb").val();
|
||||||
const $divListe = $("#div_listetables");
|
const $divListe = $("#div_listetables");
|
||||||
|
|
||||||
// Nettoyage des zones
|
// 1. Avant tout, on nettoie les résidus du SelectPicker dans le BODY
|
||||||
|
// Bootstrap-select ajoute une div .bootstrap-select à la fin du body quand container:body est utilisé
|
||||||
|
$('.bootstrap-select.dropdown.bs-container').remove();
|
||||||
|
|
||||||
|
// Nettoyage des zones de contenu
|
||||||
$("#div_lister_table").html("");
|
$("#div_lister_table").html("");
|
||||||
$('#div_maj_table').html("");
|
$('#div_maj_table').html("");
|
||||||
|
|
||||||
// Détruire l'instance existante pour éviter les fuites de mémoire et conflits
|
|
||||||
if ($("#listetables").length) {
|
|
||||||
$("#listetables").selectpicker('destroy');
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: racineWeb + "Ajaxfiltretablesreference/",
|
url: racineWeb + "Ajaxfiltretablesreference/",
|
||||||
type : 'post',
|
type : 'post',
|
||||||
data: { numeroTable: numeroTable },
|
data: { numeroTable: numeroTable },
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
// 1. On injecte le contenu (qui contient le nouveau <select id="listetables">)
|
// 2. On injecte le nouveau HTML (le select natif)
|
||||||
$divListe.html(data);
|
$divListe.html(data);
|
||||||
|
|
||||||
// 2. Initialisation propre
|
// 3. On initialise proprement
|
||||||
const $select = $("#listetables");
|
const $select = $("#listetables");
|
||||||
|
|
||||||
|
// Sécurité : on s'assure qu'il n'y a pas d'instance résiduelle sur l'élément lui-même
|
||||||
|
$select.selectpicker('destroy');
|
||||||
|
|
||||||
$select.selectpicker({
|
$select.selectpicker({
|
||||||
liveSearch: true,
|
liveSearch: true,
|
||||||
size: 10,
|
size: 10,
|
||||||
container: 'body',
|
container: 'body'
|
||||||
noneSelectedText: 'Sélectionnez une table...' // Optionnel : texte si vide
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3. Focus UX Neutral Pro
|
// 4. Focus UX Neutral Pro
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
// On cible le bouton généré par Bootstrap-select
|
|
||||||
$divListe.find('.bootstrap-select .dropdown-toggle').focus();
|
$divListe.find('.bootstrap-select .dropdown-toggle').focus();
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user