Does anyone know of a way to programmatically sort the options in a Select List custom field? It can be accomplished via the UI using the link indicated in this screenshot, but we programmatically add items to a couple of lists and would like to also be able to programmatically sort the lists after doing do. We use the OptionsManager interface, which offers several methods for managing lists, but none for sorting. Thanks!
Thanks, Peter-Dave. Even better, I found a sortOptionsByValue() method in the Options class and am accomplishing the task as follows:
ComponentAccessor.getOptionsManager().getOptions(fieldConfig).sortOptionsByValue(null)
With the OptionsManager interface, you can retrieve the list of options, sort it in memory and adjust the sequence field for each option, then use "updateOptions()" to save the new sorted list.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.