specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
60 stars 36 forks source link

Add ability to reorder/sort picklists #4539

Open grantfitzsimmons opened 6 months ago

grantfitzsimmons commented 6 months ago

I would like to be able to order the picklist terms in descending order, and I find that there are fields that are sorted and others that are not. If I apply the sorting from the schema it doesn't work.

image

I think the reason why some terms are sorted is because they were entered in order in the picklist.

Requested by: Museu de Ciències Naturals de Barcelona on Trello

maxpatiiuk commented 6 months ago

PickList has a sortType field which itself is a pick list of one of 3 options: 0 - sort in order in which items were entered 1 - sort by title field 2 - sort by the value of the "ordinal" field, thus allowing any custom sort you want (no explicit way to say Descending sort though)

Specify does it's best to respect this field for pick lists in the form, workbench and other places, though it's possible that some places were missed

The real issue here is that the field is hidden and not present on default PickList forms

bronwyncombs commented 3 months ago

From Paul Blom @ College of Idaho:

A request for future improvement would be to let the user alphabetize the picklist items. Or have easy methods for exporting, deleting, and uploading items.

maxpatiiuk commented 2 months ago

Or have easy methods for exporting, deleting, and uploading items.

That would probably be the responsibility of the batch editor. Pretty simple for picklist items without any usage. Quite tricky for pick list items with usages as picklist item references are not based on the PickListItem.id field but on the PickListItem.value (thus SQL natively doesn't know in what places is a given PickListItem used, thus can't enforce referential integrity)