Commit 7d6811d6 authored by David Stutz's avatar David Stutz

Some fixes for #628.

parent 2ba8085c
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
this.buildFilter(); this.buildFilter();
this.updateButtonText(); this.updateButtonText();
this.updateSelectAll(); this.updateSelectAll(true);
if (this.options.disableIfEmpty && $('option', this.$select).length <= 0) { if (this.options.disableIfEmpty && $('option', this.$select).length <= 0) {
this.disable(); this.disable();
...@@ -1212,7 +1212,7 @@ ...@@ -1212,7 +1212,7 @@
this.buildFilter(); this.buildFilter();
this.updateButtonText(); this.updateButtonText();
this.updateSelectAll(); this.updateSelectAll(true);
if (this.options.disableIfEmpty && $('option', this.$select).length <= 0) { if (this.options.disableIfEmpty && $('option', this.$select).length <= 0) {
this.disable(); this.disable();
...@@ -1322,7 +1322,7 @@ ...@@ -1322,7 +1322,7 @@
/** /**
* Updates the select all checkbox based on the currently displayed and selected checkboxes. * Updates the select all checkbox based on the currently displayed and selected checkboxes.
*/ */
updateSelectAll: function() { updateSelectAll: function(notTriggerOnSelectAll) {
if (this.hasSelectAll()) { if (this.hasSelectAll()) {
var allBoxes = $("li:not(.multiselect-item):not(.filter-hidden) input:enabled", this.$ul); var allBoxes = $("li:not(.multiselect-item):not(.filter-hidden) input:enabled", this.$ul);
var allBoxesLength = allBoxes.length; var allBoxesLength = allBoxes.length;
...@@ -1339,7 +1339,9 @@ ...@@ -1339,7 +1339,9 @@
selectAllInput.prop("checked", false); selectAllInput.prop("checked", false);
selectAllLi.removeClass(this.options.selectedClass); selectAllLi.removeClass(this.options.selectedClass);
if (checkedBoxesLength === 0) { if (checkedBoxesLength === 0) {
this.options.onSelectAll(false); if (!notTriggerOnSelectAll) {
this.options.onSelectAll(false);
}
} }
} }
} }
......
...@@ -2059,8 +2059,8 @@ ...@@ -2059,8 +2059,8 @@
$(document).ready(function() { $(document).ready(function() {
$('#example-onSelectAll').multiselect({ $('#example-onSelectAll').multiselect({
includeSelectAllOption: true, includeSelectAllOption: true,
onSelectAll: function() { onSelectAll: function(checked) {
alert('onSelectAll triggered.'); alert('onSelectAll triggered: ' + (checked ? 'selected all' : 'deselected all') + '!');
} }
}); });
}); });
......
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