partstable fixed matrici dropdown

This commit is contained in:
Claudio 2025-10-28 09:31:13 +01:00
parent 8d6fe92481
commit 9969cc9edc

View File

@ -1474,8 +1474,8 @@ $(document).ready(function () {
},
});
// Ripristina il valore se valido
if (partId && partId !== "new" && currentValue) {
// === MODIFICA CHIRURGICA: solo qui ===
if (currentValue && currentValue !== "new") {
const matrice = matrici.find((m) => m.IdMatrice == currentValue);
if (matrice) {
const option = new Option(
@ -1487,11 +1487,15 @@ $(document).ready(function () {
$select.append(option).trigger("change");
partMatrice[partNumber] = matrice.IdMatrice;
} else {
// Aggiusta valore non valido
$select.val(null).trigger("change");
partMatrice[partNumber] = null;
}
} else {
// Nessun valore: assicurati che sia vuoto
$select.val(null).trigger("change");
partMatrice[partNumber] = null;
}
// === FINE MODIFICA ===
$select.on("change", function () {
const idmatrice = $(this).val();