Skip to content

Dynamic search based select #213

Open
@jroper

Description

This would probably be an entirely new feature. But, imagine you have a system with a million users stored in a database. And you want to select one based on a simple text search. Obviously, fetching a million users and rendering them in the select, and then using the searcher function to match them, is infeasible. Instead, you want the items that appear to be selected to be dynamic, using API calls to the backend to fetch the items based on what the user has typed so far. So, to implement it, instead of a static list of items, you'll have a callback:

func(input string) interface{}

This would have to use goroutines/channels to invoke the search in the background, while allowing the user to continue to enter text, so that after a user types a certain number of characters, it can immediately issue the search callback, and then continue to allow the user to type and refine the search, waiting till the previous callback has returned till it invokes the callback again with the currently input text (if different from the previous callback invocation).

Since Items in Select is currently interface{}, perhaps it could be possible to add this support to the existing select, I'm not sure if that would make sense or not.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions