Fomantic-UI
Fomantic-UI copied to clipboard
[dropdown] add behavior to sort a dropdown list
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
):
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
.
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.