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

  • Allow HTML content mode in dropdown items
  • Easy way to highlight matching part of suggestions
  • After search field blur do not popup suggestions
  • Lot of SASS variables to allow you to adjust look'n feel
  • Do not open pending dropdown if field has been blured
  • Open dropdown after focus of field if value present
Released
2018-02-22
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

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

SearchDropDown - Vaadin Add-on Directory

SearchDropDown provides search field with drop down for suggestions SearchDropDown - Vaadin Add-on Directory
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.
Online