Skip to content

Commit

Permalink
Add model to resultItem
Browse files Browse the repository at this point in the history
Merge pull request #1 from rpapeters/v3.8.0

Add model to resultItem
Add showSuggestions function
  • Loading branch information
Rob Peters committed Oct 17, 2018
1 parent 0760468 commit 6e438e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 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 Expand Up @@ -921,6 +926,7 @@
var resultItem = {};
resultItem[this.textProperty] = objText;
resultItem[this.valueProperty] = objValue;
resultItem.model = item;
queryResult.push(resultItem);
}
}.bind(this));
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 6e438e0

Please sign in to comment.