Skip to content

Feature Request: Allow for sorting options in filterOptions prop #2677

@bobbyrenwick

Description

@bobbyrenwick

In v1 overriding the standard filterOptions meant that you could return the options in a completely different order based on the search, whereas the new filterOption is only giving us the option to specify if that option should be shown or not.

I think that having some way of ordering the results is useful in lots of cases. Here's one with some dummy data. Let's suppose that my options is a long list of names and we expect that someone will probably start typing the person's first name in order to get to that person as quickly as possible, but they might also only know a surname.

If we have the following names at the start of the options, "Alexa Nabil", "Alexandra Bilani", "Bill Ward" and the user starts typing "Bi" then currently the default behaviour of react-select is to show the options in their original, alphabetical order, but I'd suggest that "Bill Ward", "Alexandra Bilani", "Alexa Nabil" makes more sense once there's the user input. That's possible with filterOptions because you can sort the options at the same time as filtering them, but v2 leaves me without a way of doing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/reviewedIssue has recently been reviewed (mid-2020)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions