dropdown in alphabetical order

This commit is contained in:
2026-02-25 10:02:45 +01:00
parent 497ebda65a
commit 35021e9d9b
3 changed files with 32 additions and 4 deletions
+14
View File
@@ -1846,6 +1846,10 @@ function fixedDefaultValue(array $f): string
}
const items = dropdownData[fieldId];
// ✅ Sort alphabetically by Valore (A→Z)
items.sort((a, b) => String(a.Valore || '').localeCompare(String(b.Valore || ''), 'it', {
sensitivity: 'base'
}));
const valToSelect = currentValue || selectedValue;
if (items.length > 12) {
@@ -2319,6 +2323,12 @@ function fixedDefaultValue(array $f): string
id: item[config.idKey],
text: (item.Codice ? item.Codice + ' - ' : '') + (item[config.textKey] || 'Senza nome')
}));
// ✅ Sort alphabetically by text
results.sort((a, b) => String(a.text || '').localeCompare(String(b.text || ''), 'it', {
sensitivity: 'base'
}));
fixedFieldDataCache[cacheKey] = results;
return results;
} catch (err) {
@@ -2378,6 +2388,10 @@ function fixedDefaultValue(array $f): string
id: item[config.idKey],
text: (item.Codice ? item.Codice + ' - ' : '') + (item[config.textKey] || 'Senza nome')
}));
// ✅ Sort alphabetically by text
results.sort((a, b) => String(a.text || '').localeCompare(String(b.text || ''), 'it', {
sensitivity: 'base'
}));
} else {
results = await loadFixedFieldData(fieldKey);
}