diff --git a/src/components/VueBootstrapTypeahead.vue b/src/components/VueBootstrapTypeahead.vue index e172442..1d57bd2 100644 --- a/src/components/VueBootstrapTypeahead.vue +++ b/src/components/VueBootstrapTypeahead.vue @@ -34,6 +34,7 @@ :text-variant="textVariant" :maxMatches="maxMatches" :minMatchingChars="minMatchingChars" + :showAllResults="showAllResults" @hit="handleHit" > @@ -92,6 +93,10 @@ export default { type: Number, default: 2 }, + showAllResults: { + type: Boolean, + default: false + }, placeholder: String, prepend: String, append: String diff --git a/src/components/VueBootstrapTypeaheadList.vue b/src/components/VueBootstrapTypeaheadList.vue index f404987..6ef1628 100644 --- a/src/components/VueBootstrapTypeaheadList.vue +++ b/src/components/VueBootstrapTypeaheadList.vue @@ -56,6 +56,10 @@ export default { minMatchingChars: { type: Number, default: 2 + }, + showAllResults: { + type: Boolean, + default: false } }, @@ -80,6 +84,10 @@ export default { if (this.query.length === 0 || this.query.length < this.minMatchingChars) { return [] } + // If the user only just want to list the possible suggestions (e.g. the filter are on backend) the showAllResults property is turn on + if (this.showAllResults) { + return this.data.slice(0, this.maxMatches) + } const re = new RegExp(this.escapedQuery, 'gi')