Skip to content

Commit

Permalink
only reload view when searching and searchbox is empty if there is a …
Browse files Browse the repository at this point in the history
…previous value (#2402)
  • Loading branch information
caseyjhol committed May 21, 2020
1 parent ece1803 commit c08e164
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -2635,6 +2635,7 @@
this.$button.on('click.bs.dropdown.data-api', function () {
if (!!that.$searchbox.val()) {
that.$searchbox.val('');
that.selectpicker.search.previousValue = undefined;
}
});

Expand All @@ -2643,7 +2644,7 @@
});

this.$searchbox.on('input propertychange', function () {
var searchValue = that.$searchbox.val();
var searchValue = that.$searchbox[0].value;

that.selectpicker.search.elements = [];
that.selectpicker.search.data = [];
Expand Down Expand Up @@ -2699,10 +2700,12 @@
that.selectpicker.search.elements = searchMatch;
that.createView(true);
showNoResults.call(that, searchMatch, searchValue);
} else {
} else if (that.selectpicker.search.previousValue) { // for IE11 (#2402)
that.$menuInner.scrollTop(0);
that.createView(false);
}

that.selectpicker.search.previousValue = searchValue;
});
},

Expand Down

0 comments on commit c08e164

Please sign in to comment.