Skip to content

Commit

Permalink
snapappointments#1139 Adds the class "bs-noneSelected" to the button …
Browse files Browse the repository at this point in the history
…when no option is selected.
  • Loading branch information
nulrik committed Oct 30, 2015
1 parent 92a0563 commit 58753c2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
10 changes: 10 additions & 0 deletions dist/js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,10 @@
this.$button.children('.filter-option').html(title);

this.$element.trigger('rendered.bs.select');

if (!this.multiple && !this.val()) {
this.$button.addClass("bs-noneSelected");
}
},

/**
Expand Down Expand Up @@ -973,6 +977,12 @@
}

$lis.toggleClass('selected', selected);

if (this.val() === null) {
this.$button.addClass("bs-noneSelected");
} else {
this.$button.removeClass("bs-noneSelected");
}
},

setDisabled: function (index, disabled, $lis) {
Expand Down
2 changes: 1 addition & 1 deletion dist/js/bootstrap-select.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/bootstrap-select.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,10 @@
this.$button.children('.filter-option').html(title);

this.$element.trigger('rendered.bs.select');

if (!this.multiple && !this.val()) {
this.$button.addClass("bs-noneSelected");
}
},

/**
Expand Down Expand Up @@ -950,6 +954,12 @@
}

$lis.toggleClass('selected', selected);

if (this.val() === null) {
this.$button.addClass("bs-noneSelected");
} else {
this.$button.removeClass("bs-noneSelected");
}
},

setDisabled: function (index, disabled, $lis) {
Expand Down
3 changes: 3 additions & 0 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
body {
padding-top: 70px;
}
.bootstrap-select .bs-noneSelected {
color: #999;
}
</style>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
Expand Down

0 comments on commit 58753c2

Please sign in to comment.