Skip to content

Commit dee4df2

Browse files
committed
Add filterFunction property
1 parent 1d7ab52 commit dee4df2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@ And arrays of objects
6767
| showDefaultOption | sets the select title is set as an option | Boolean | false | |
6868
| textProp | the option's prop that is displayed as the option's text | String | text | |
6969
| valueProp | the option's prop that is used to find the selected value | String | value |
70+
| filterFunction | a function that can be used to do own filtering | Function (options, searchValue) => filteredOptions | lowercase string comparison |
7071

src/vue-bootstrap-select.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ export default {
9292
valueProp: {
9393
type: String,
9494
default: "value"
95+
},
96+
filterFunction: {
97+
type: Function,
98+
default: null
9599
}
96100
},
97101
data() {
@@ -110,6 +114,9 @@ export default {
110114
},
111115
filteredOptions() {
112116
if (this.searchable && this.searchValue.length > 0) {
117+
if (this.filterFunction) {
118+
return this.filterFunction(this.options, this.searchValue);
119+
}
113120
return this.options.filter(item => {
114121
if (typeof item === "object") {
115122
return (

0 commit comments

Comments
 (0)