diff --git a/CHANGES.md b/CHANGES.md index bab01cd279..2b36acc9ee 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,5 @@ # 6.5.12 2024-??-?? + - 2025-02-06 Added SortBy and SortOrder options to Znuny.Form.Input.Set to sort select field options by key or value. - 2025-01-22 Fixed uninitialized value bug. TicketZoom/Agent/MIMEBase.pm - Added special handling for 'undef' values in the arrayref $Event->{$Property}. - 2025-01-21 Fixed Bug - Problem when handling errors in the owner field in the activity dialog. Thanks to Daylton Rodrigues (@dayltonr) for reporting. [#627](https://github.com/znuny/Znuny/issues/627). - 2025-01-16 Increased size of columns profile_key and profile_value of database table search_profile. diff --git a/var/httpd/htdocs/js/Znuny.Form.Input.js b/var/httpd/htdocs/js/Znuny.Form.Input.js index 88078a1006..712ea2aa9a 100644 --- a/var/httpd/htdocs/js/Znuny.Form.Input.js +++ b/var/httpd/htdocs/js/Znuny.Form.Input.js @@ -535,14 +535,20 @@ Znuny.Form.Input = (function (TargetNS) { var Success = Znuny.Form.Input.Set('Queue', 'Postmaster', { - KeyOrValue: 'Value', - TriggerChange: 'false', + KeyOrValue: 'Value', # Key, Value + TriggerChange: 'false', + Modernize: true, # true, false + + SelectOption: true, # true, false - set options of select field + AddEmptyOption: true, # true, false - add empty option as first option for single-selects/dropdowns + SortBy: 'Key', # Key, Value - Key is default + SortOrder: 'ASC', # ASC, DESC - ASC is default } ); Returns: - var Success = true; # true, false + var Success = true; # true, false */ TargetNS.Set = function (Attribute, Content, Options) { @@ -858,6 +864,7 @@ Znuny.Form.Input = (function (TargetNS) { $('#'+ FieldID +' option').remove(); function AppendOptions() { + var ContentArray; // Add empty option as first option for single-selects/dropdowns // because otherwise somehow the first element will be selected @@ -873,11 +880,58 @@ Znuny.Form.Input = (function (TargetNS) { ) { $('#'+ FieldID).append($('