dropdown in alphabetical order
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user