Skip to content

Commit a96a95a

Browse files
committed
Merge pull request davidstutz#256 from yuripc/patch-1
Fix filterBehavior 'both'.
2 parents bc9a8f2 + 6337f96 commit a96a95a

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

js/bootstrap-multiselect.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,17 @@
608608
if (this.query !== event.target.value) {
609609
this.query = event.target.value;
610610

611+
var filterCandidate = '';
612+
if ((this.options.filterBehavior === 'text')) {
613+
filterCandidate = text;
614+
}
615+
else if ((this.options.filterBehavior === 'value')) {
616+
filterCandidate = value;
617+
}
618+
else if (this.options.filterBehavior === 'both') {
619+
filterCandidate = text + '\n' + value;
620+
}
621+
611622
$.each($('li', this.$ul), $.proxy(function(index, element) {
612623
var value = $('input', element).val();
613624
var text = $('label', element).text();
@@ -617,14 +628,6 @@
617628
// interesting for this search
618629
var showElement = false;
619630

620-
var filterCandidate = '';
621-
if ((this.options.filterBehavior === 'text' || this.options.filterBehavior === 'both')) {
622-
filterCandidate = text;
623-
}
624-
if ((this.options.filterBehavior === 'value' || this.options.filterBehavior === 'both')) {
625-
filterCandidate = value;
626-
}
627-
628631
if (this.options.enableCaseInsensitiveFiltering && filterCandidate.toLowerCase().indexOf(this.query.toLowerCase()) > -1) {
629632
showElement = true;
630633
}

0 commit comments

Comments
 (0)