Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

Commit

Permalink
MultiSelector should clear filtering if options are being reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr0grog committed May 2, 2012
1 parent 6e18bf1 commit 526a35d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/MultiSelector.js
Expand Up @@ -101,6 +101,7 @@ MultiSelector.prototype = {
for (var i=0, len=options.length; i < len; i++) {
this.addOption(options[i]);
}
this.clearFilter();
},

addOption: function (option) {
Expand All @@ -119,8 +120,8 @@ MultiSelector.prototype = {
},

filterOptions: function (filter) {
var alwaysMatch = !filter;
filter = filter && filter.toUpperCase();
var alwaysMatch = !filter;
for (var i=0, len=this.options.length; i < len; i++) {
var matches = alwaysMatch || this.options[i].name.toUpperCase().indexOf(filter) > -1;
this.options[i].element.style.display = matches ? "" : "none";
Expand Down

0 comments on commit 526a35d

Please sign in to comment.