fix: re-implement numeric natural sorting for dropdowns

This commit is contained in:
2026-05-01 13:58:22 -04:00
parent 46fbe7c98d
commit 7d9af30ed3
@@ -19,12 +19,17 @@
dropdownParent: 'body',
controlInput: '<input>',
sortField: [{
field: '$text',
field: 'text',
direction: 'asc'
}],
render: {
option: function(item, escape) {
return '<div>' + escape(item.text) + '</div>';
// Natural sort plugin or custom sorter:
// We use a custom sort function to handle the "1 - ..." format
// This ensures "1" < "2" < "10"
sortField: {
field: 'text',
direction: 'asc',
func: function(a, b) {
return a.text.localeCompare(b.text, undefined, {numeric: true, sensitivity: 'base'});
}
}
});