Directory

← Back

SearchDropDown

SearchDropDown provides search field with drop down for suggestions

Author

Rating

Popularity

<100

SearchDropDown is designed to be used when your application needs to perform query or queries to resolve suggestions for search field. And when set of possible suggestions is too large to be stored in memory in hope that those might be needed.

Sample code

public static final String VALUES[] = { "alfa", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel",
    "india", "juliett", "kilo", "lima", "mike", "november", "oscar", "papa", "quebec", "romea", "sierra",
    "tango", "uniform", "victor", "whiskey", "xray", "yankee", "zulu" };

SimpleSearchDropDown simpleSearch = new SimpleSearchDropDown(query -> {
    // For empty query, do not provide any suggestions
    final String cleaned = query.toLowerCase().trim();
    if(cleaned.isEmpty()) {
        return Collections.EMPTY_LIST;
    }

    // Normally here you would perform database or REST query or queries, to find suitable suggestions.
    // Simple API is always synchronous, so when you want to go to asynchronous use base class.
    return Arrays.stream(VALUES).filter(v -> v.contains(cleaned)).collect(Collectors.toList());
});
simpleSearch.setPlaceHolder("Search Phonetic Alphabets");
simpleSearch.addSearchListener(e -> Notification.show("User selected: " + e.getText()));

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

  • Increase Vaadin dependency to 8.3
  • Fix dropdown alignment issues with Vaadin 8.3
Released
2018-02-14
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 8.2+
Vaadin 8.0+ in 0.1.0
Browser
Firefox
Opera
Safari
Google Chrome
iOS Browser
Android Browser
Internet Explorer
Microsoft Edge

Vaadin Add-on Directory

Find open-source widgets, add-ons, themes, and integrations for your Vaadin application. Vaadin Add-on Directory
The channel for finding, promoting, and distributing Vaadin add-ons.
Online