Skip to content

Commit 1232d65

Browse files
authored
Update multiselectMixin.js
1 parent d1dcb4c commit 1232d65

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lib/multiselectMixin.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ module.exports = {
99
}
1010
},
1111
props: {
12+
/**
13+
* Decide whether to filter the results based on search query.
14+
* Useful for async filtering, where we search through more complex data.
15+
* @type {Boolean}
16+
*/
17+
localSearch: {
18+
type: Boolean,
19+
default: true
20+
},
1221
/**
1322
* Array of available options: Objects, Strings or Integers.
1423
* If array of objects, visible label will default to option.label.
@@ -176,9 +185,11 @@ module.exports = {
176185
let options = this.hideSelected
177186
? this.options.filter(this.isNotSelected)
178187
: this.options
179-
options = this.label
180-
? options.filter((option) => option[this.label].includes(this.search))
181-
: options.filter((option) => option.includes(this.search))
188+
if (this.localSearch) {
189+
options = this.label
190+
? options.filter((option) => option[this.label].includes(this.search))
191+
: options.filter((option) => option.includes(this.search))
192+
}
182193
if (this.taggable && search.length && !this.isExistingOption(search)) {
183194
options.unshift({ isTag: true, label: search })
184195
}

0 commit comments

Comments
 (0)