Fomantic-UI icon indicating copy to clipboard operation
Fomantic-UI copied to clipboard

[dropdown] add behavior to sort a dropdown list

Open mdrxy opened this issue 9 months ago • 1 comments

Feature Request

I'm running into an issue wherein if the sortSelect setting is set for a dropdown, it does not apply to items injected into the dropdown at a later time (via setup menu):

Screenshot 2024-05-09 at 00 24 15

Example (if possible)

Adding a behavior such as sort(value) where value is one of the existing sortSelect options (natural, function(a, b){}). Calling sort() with no argument will default to true.

mdrxy avatar May 09 '24 04:05 mdrxy

The values object can also contain submenus or additional headers or dividers (see https://fomantic-ui.com/modules/dropdown.html#initializing-with-javascript-only). That said, it isn't the same simple one-level sort logic as for sorting the select values on initial conversion (what sortSelect is for) and could get quite complex to support every possible item type. If you want to use the "setup menu" behavior, i suggest you make sure the the provided data is sorted as you like beforehand on your own.

lubber-de avatar May 11 '24 17:05 lubber-de