mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-07 07:12:23 +03:00
Add option to disable filtering options by the search text
If the filtering is done on the server-side or the search text isn't contained in the option text then this should be set to `false`.
This commit is contained in:
@@ -504,6 +504,16 @@
|
||||
default: false
|
||||
},
|
||||
|
||||
/**
|
||||
* When true, existing options will be filtered
|
||||
* by the search text.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
filterOptions: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
|
||||
/**
|
||||
* User defined function for adding Options
|
||||
* @type {Function}
|
||||
@@ -887,6 +897,9 @@
|
||||
* @return {array}
|
||||
*/
|
||||
filteredOptions() {
|
||||
if (this.filterOptions === false) {
|
||||
return this.mutableOptions
|
||||
}
|
||||
let options = this.mutableOptions.filter((option) => {
|
||||
if (typeof option === 'object' && option.hasOwnProperty(this.label)) {
|
||||
return option[this.label].toLowerCase().indexOf(this.search.toLowerCase()) > -1
|
||||
|
||||
Reference in New Issue
Block a user