der
This commit is contained in:
parent
c95aa120c5
commit
f80fcfafd4
|
|
@ -47857,23 +47857,34 @@ function formAjoutTableRef() {
|
|||
|
||||
// 4. Focus intelligent sur le PREMIER champ du formulaire
|
||||
setTimeout(function() {
|
||||
// Sélecteur qui exclut strictement : hidden, disabled, readonly
|
||||
// 1. Définition du sélecteur étendu
|
||||
// On cherche les inputs, textarea et les selects (même ceux cachés par selectpicker)
|
||||
var selector = 'input:not([type="hidden"]):not(:disabled):not([readonly]):visible, ' +
|
||||
'select:not(:disabled):not([readonly]):visible, ' +
|
||||
'textarea:not(:disabled):not([readonly]):visible';
|
||||
'textarea:not(:disabled):not([readonly]):visible, ' +
|
||||
'select:not(:disabled):not([readonly])'; // On enlève :visible ici pour le select
|
||||
|
||||
var $firstField = $('#div_maj_table').find(selector).first();
|
||||
|
||||
|
||||
if ($firstField.length > 0) {
|
||||
if ($firstField.hasClass('selectpicker')) {
|
||||
// SOLUTION CIBLÉE : On force le focus sur le bouton généré par le plugin
|
||||
$firstField.closest('.bootstrap-select').find('.dropdown-toggle').focus();
|
||||
} else {
|
||||
// Focus standard pour input et textarea
|
||||
// 2. Cas du Selectpicker
|
||||
if ($firstField.hasClass('selectpicker') || $firstField.parent().hasClass('bootstrap-select')) {
|
||||
// On va chercher le bouton dropdown-toggle
|
||||
var $container = $firstField.closest('.bootstrap-select');
|
||||
|
||||
// Si le container n'est pas encore prêt, on force un petit rappel
|
||||
if ($container.length > 0) {
|
||||
$container.find('.dropdown-toggle').focus();
|
||||
} else {
|
||||
// Secours : focus sur le select lui-même pour déclencher le plugin
|
||||
$firstField.selectpicker('focus');
|
||||
}
|
||||
}
|
||||
// 3. Cas standard
|
||||
else {
|
||||
$firstField.focus();
|
||||
}
|
||||
}
|
||||
}, 300); // 300ms pour être sûr que le Selectpicker est totalement dessiné
|
||||
}, 400); // On monte à 400ms pour laisser le temps au Selectpicker de se dessiner
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -47978,23 +47989,34 @@ function formModifTableRef($idData) {
|
|||
|
||||
// 4. Focus intelligent sur le PREMIER champ du formulaire
|
||||
setTimeout(function() {
|
||||
// Sélecteur qui exclut strictement : hidden, disabled, readonly
|
||||
// 1. Définition du sélecteur étendu
|
||||
// On cherche les inputs, textarea et les selects (même ceux cachés par selectpicker)
|
||||
var selector = 'input:not([type="hidden"]):not(:disabled):not([readonly]):visible, ' +
|
||||
'select:not(:disabled):not([readonly]):visible, ' +
|
||||
'textarea:not(:disabled):not([readonly]):visible';
|
||||
'textarea:not(:disabled):not([readonly]):visible, ' +
|
||||
'select:not(:disabled):not([readonly])'; // On enlève :visible ici pour le select
|
||||
|
||||
var $firstField = $('#div_maj_table').find(selector).first();
|
||||
|
||||
|
||||
if ($firstField.length > 0) {
|
||||
if ($firstField.hasClass('selectpicker')) {
|
||||
// SOLUTION CIBLÉE : On force le focus sur le bouton généré par le plugin
|
||||
$firstField.closest('.bootstrap-select').find('.dropdown-toggle').focus();
|
||||
} else {
|
||||
// Focus standard pour input et textarea
|
||||
// 2. Cas du Selectpicker
|
||||
if ($firstField.hasClass('selectpicker') || $firstField.parent().hasClass('bootstrap-select')) {
|
||||
// On va chercher le bouton dropdown-toggle
|
||||
var $container = $firstField.closest('.bootstrap-select');
|
||||
|
||||
// Si le container n'est pas encore prêt, on force un petit rappel
|
||||
if ($container.length > 0) {
|
||||
$container.find('.dropdown-toggle').focus();
|
||||
} else {
|
||||
// Secours : focus sur le select lui-même pour déclencher le plugin
|
||||
$firstField.selectpicker('focus');
|
||||
}
|
||||
}
|
||||
// 3. Cas standard
|
||||
else {
|
||||
$firstField.focus();
|
||||
}
|
||||
}
|
||||
}, 300); // 300ms pour être sûr que le Selectpicker est totalement dessiné
|
||||
}, 400); // On monte à 400ms pour laisser le temps au Selectpicker de se dessiner
|
||||
},
|
||||
error: function(xhr) {
|
||||
toastr.error("Erreur de chargement du formulaire");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user