fix(partsTable): initialize new item matrice as empty and refresh on global filter change

- Default new items' matrice to empty to prevent stale values leaking from prior state
- Force matrice update when the global filter changes to keep items in sync
This commit is contained in:
Martin Grigoryan 2025-10-29 14:17:00 +04:00
parent 8d6fe92481
commit 683073c244

View File

@ -1339,6 +1339,7 @@ $(document).ready(function () {
partId, partId,
currentValue, currentValue,
selectedMacro, selectedMacro,
true
); );
}); });
}); });
@ -1415,6 +1416,7 @@ $(document).ready(function () {
partId, partId,
idmatrice, idmatrice,
selectedMacro = null, selectedMacro = null,
fromFilter = false
) { ) {
if (typeof $.fn.select2 === "undefined") { if (typeof $.fn.select2 === "undefined") {
$select.replaceWith( $select.replaceWith(
@ -1484,14 +1486,19 @@ $(document).ready(function () {
true, true,
true, true,
); );
$select.append(option).trigger("change");
if (!fromFilter) $select.append(option).trigger("change");
else $select.append(option);
partMatrice[partNumber] = matrice.IdMatrice; partMatrice[partNumber] = matrice.IdMatrice;
} else { } else {
// Aggiusta valore non valido // Aggiusta valore non valido
$select.val(null).trigger("change"); $select.val(null).trigger("change");
partMatrice[partNumber] = null; partMatrice[partNumber] = null;
} }
} } else {
$select.val(null).trigger("change");
}
$select.on("change", function () { $select.on("change", function () {
const idmatrice = $(this).val(); const idmatrice = $(this).val();