mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +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
|
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
|
* User defined function for adding Options
|
||||||
* @type {Function}
|
* @type {Function}
|
||||||
@@ -887,6 +897,9 @@
|
|||||||
* @return {array}
|
* @return {array}
|
||||||
*/
|
*/
|
||||||
filteredOptions() {
|
filteredOptions() {
|
||||||
|
if (this.filterOptions === false) {
|
||||||
|
return this.mutableOptions
|
||||||
|
}
|
||||||
let options = this.mutableOptions.filter((option) => {
|
let options = this.mutableOptions.filter((option) => {
|
||||||
if (typeof option === 'object' && option.hasOwnProperty(this.label)) {
|
if (typeof option === 'object' && option.hasOwnProperty(this.label)) {
|
||||||
return option[this.label].toLowerCase().indexOf(this.search.toLowerCase()) > -1
|
return option[this.label].toLowerCase().indexOf(this.search.toLowerCase()) > -1
|
||||||
|
|||||||
Reference in New Issue
Block a user