DynamicField Sorting Values by Key

English! place to talk about development, programming and coding
Post Reply
stoicamarcus23
Znuny newbie
Posts: 18
Joined: 26 Jan 2016, 10:12
Znuny Version: OTRS 5

DynamicField Sorting Values by Key

Post by stoicamarcus23 »

Hi,

I want all dropdown fields displayed in the agent.pl webpage ordered not alphabetical instead I want the fields to be ordered by the key values that I entered in the drop down settings in Sysconfig).
Example :
A dropdown Dynamic Field named Car with the Values:
Audi,BMW,Toyota.
The key`s set for these values are Audi =3 , BMW=2,Toyota=1;
The fields are displayed in the order Audi,BMW,Toyota , but I would like to have them ordered like : Toyota,BMW,Audi.
How can I change the order ?
Thanks by advance,
Marcus
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: DynamicField Sorting Values by Key

Post by reneeb »

Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
stoicamarcus23
Znuny newbie
Posts: 18
Joined: 26 Jan 2016, 10:12
Znuny Version: OTRS 5

Re: DynamicField Sorting Values by Key

Post by stoicamarcus23 »

Thank you very much for the solution provided.
It does exactly what I was lookin for .
Advice for those who will also use this package:
I have installed the package using Package Manager from the Admin option.After that the sorting did not work very well ,more exactly the sort by option was not loaded every time .
In order to make it work I had to manually overwrite these files:
Custom/Kernel/System/DynamicField/Driver/Dropdown.pm
Custom/Kernel/Output/HTML/Templates/Standard/AdminDynamicFieldDropdown.tt
Custom/Kernel/Modules/AdminDynamicFieldDropdown.pm
var/httpd/htdocs/js/Core.UI.TreeSelection.js
And also if you want to sort the values by key ,the key`s from the dynamic field should be numbered from 00 to 99.If you have something like this:
Key 12 Value CCC,Key 6 Value AAA the values in the dropdown will be shown like this CCC ,
Much appreciated for the help,
Marcus
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: DynamicField Sorting Values by Key

Post by reneeb »

stoicamarcus23 wrote:Thank you very much for the solution provided.
You're welcome... It's not an add-on that I wrote, I just happen to know that it exists on OPAR... ;-)
In order to make it work I had to manually overwrite these files:
Custom/Kernel/System/DynamicField/Driver/Dropdown.pm
Custom/Kernel/Output/HTML/Templates/Standard/AdminDynamicFieldDropdown.tt
Custom/Kernel/Modules/AdminDynamicFieldDropdown.pm
var/httpd/htdocs/js/Core.UI.TreeSelection.js
What does that mean? Did you change the files or did you just copy them...
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
stoicamarcus23
Znuny newbie
Posts: 18
Joined: 26 Jan 2016, 10:12
Znuny Version: OTRS 5

Re: DynamicField Sorting Values by Key

Post by stoicamarcus23 »

I have copied the files did not made any changes in the files.
Post Reply