Commit 75501599 authored by David Stutz's avatar David Stutz

Merge branch 'master' of https://github.com/davidstutz/bootstrap-multiselect, fixed select all.

Conflicts:
	js/bootstrap-multiselect.js
parents 49e25ebc a50ba907
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
</select> </select>
</td> </td>
<td> <td>
Multiselect with a 'Select all' option Multiselect with a 'Select all' option.
</td> </td>
</tr> </tr>
<tr> <tr>
......
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
</select> </select>
</td> </td>
<td> <td>
Multiselect with a 'Select all' option Multiselect with a 'Select all' option.
</td> </td>
</tr> </tr>
<tr> <tr>
......
...@@ -346,14 +346,15 @@ ...@@ -346,14 +346,15 @@
if (this.$select[0][0].value === this.options.selectAllValue) { if (this.$select[0][0].value === this.options.selectAllValue) {
var values = []; var values = [];
var options = $('option[value!="' + this.options.selectAllValue + '"][data-role!="divider"]', this.$select);
// Check for visibility of options.
var options = $('option[value!="' + this.options.selectAllValue + '"][data-role!="divider"]', this.$select)
.filter(':visible');
for (var i = 0; i < options.length; i++) { for (var i = 0; i < options.length; i++) {
// Check whether this option is actually visible.
if (this.getInputByValue(options[i].value) && this.getInputByValue(options[i].value).is(':visible')) {
values.push(options[i].value); values.push(options[i].value);
} }
}
if (checked) { if (checked) {
this.select(values); this.select(values);
...@@ -618,18 +619,21 @@ ...@@ -618,18 +619,21 @@
var value = $('input', element).val(); var value = $('input', element).val();
var text = $('label', element).text(); var text = $('label', element).text();
if (value !== this.options.selectAllValue && text) {
// by default lets assume that element is not
// interesting for this search
var showElement = false;
var filterCandidate = ''; var filterCandidate = '';
if ((this.options.filterBehavior === 'text' || this.options.filterBehavior === 'both')) { if ((this.options.filterBehavior === 'text')) {
filterCandidate = text; filterCandidate = text;
} }
if ((this.options.filterBehavior === 'value' || this.options.filterBehavior === 'both')) { else if ((this.options.filterBehavior === 'value')) {
filterCandidate = value; filterCandidate = value;
} }
else if (this.options.filterBehavior === 'both') {
filterCandidate = text + '\n' + value;
}
if (value !== this.options.selectAllValue && text) {
// by default lets assume that element is not
// interesting for this search
var showElement = false;
if (this.options.enableCaseInsensitiveFiltering && filterCandidate.toLowerCase().indexOf(this.query.toLowerCase()) > -1) { if (this.options.enableCaseInsensitiveFiltering && filterCandidate.toLowerCase().indexOf(this.query.toLowerCase()) > -1) {
showElement = true; showElement = true;
...@@ -920,7 +924,7 @@ ...@@ -920,7 +924,7 @@
for (var i = 0; i < options.length; i = i + 1) { for (var i = 0; i < options.length; i = i + 1) {
var option = options[i]; var option = options[i];
if (option.value == valueToCompare) { if (option.value === valueToCompare) {
return $(option); return $(option);
} }
} }
...@@ -939,7 +943,7 @@ ...@@ -939,7 +943,7 @@
for (var i = 0; i < checkboxes.length; i = i + 1) { for (var i = 0; i < checkboxes.length; i = i + 1) {
var checkbox = checkboxes[i]; var checkbox = checkboxes[i];
if (checkbox.value == valueToCompare) { if (checkbox.value === valueToCompare) {
return $(checkbox); return $(checkbox);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment