sort vendors alphabetically in the dropdown list

This commit is contained in:
Manuel Weiser 2025-03-01 10:41:44 +01:00
parent bce2ad2ed8
commit 3253e7d407

View File

@ -97,8 +97,10 @@ function populateVendorDropdown(data, selectedSmId = null) {
? (weightInKg / 1000).toFixed(2) + " t" ? (weightInKg / 1000).toFixed(2) + " t"
: weightInKg.toFixed(2) + " kg"; : weightInKg.toFixed(2) + " kg";
// Dropdown mit gefilterten Herstellern befüllen // Dropdown mit gefilterten Herstellern befüllen - alphabetisch sortiert
Object.entries(filteredVendors).forEach(([id, name]) => { Object.entries(filteredVendors)
.sort(([, nameA], [, nameB]) => nameA.localeCompare(nameB)) // Sort vendors alphabetically by name
.forEach(([id, name]) => {
const option = document.createElement("option"); const option = document.createElement("option");
option.value = id; option.value = id;
option.textContent = name; option.textContent = name;