Skip to content

Commit

Permalink
Add showSuggestions function
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Peters committed Oct 17, 2018
1 parent 6b0b468 commit 1a1d08f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions paper-autocomplete-suggestions.html
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,11 @@
}.bind(this), 0);
},

showSuggestions: function (query) {
query = query || '';
this._suggestions = this.queryFn(this.source, query.toLowerCase());
},

/**
* Query function is called on each keystroke to query the data source and returns the suggestions that matches
* with the filtering logic included.
Expand Down
7 changes: 7 additions & 0 deletions paper-autocomplete.html
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,13 @@
this.$.paperAutocompleteSuggestions.hideSuggestions();
},

showSuggestions: function (query) {
if (query && this.$.autocompleteInput.value != query) {
this.$.autocompleteInput.value = query;
}
this.$.paperAutocompleteSuggestions.showSuggestions(query);
},

/**
* Allows calling the onSelect function from outside
* This in time triggers the autocomplete-selected event
Expand Down

0 comments on commit 1a1d08f

Please sign in to comment.