summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-01-04 05:58:16 (GMT)
committerNathaniel Catchpole2016-01-04 05:58:16 (GMT)
commit9f53bf089c8056daf6bb01c1011476e1201d10d5 (patch)
tree6820d13bc3fd7eefdf793294957a224a1928266c
parent6d1232f8ede40e3af7535247336f4fdf1ce21a8b (diff)
Issue #2604912 by stockholmz, pixelmord, sdstyles: Tableselect.js select all does not fire change event
-rw-r--r--core/misc/tableselect.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/core/misc/tableselect.js b/core/misc/tableselect.js
index fb82ec0..2011374 100644
--- a/core/misc/tableselect.js
+++ b/core/misc/tableselect.js
@@ -42,12 +42,17 @@
var updateSelectAll = function (state) {
// Update table's select-all checkbox (and sticky header's if available).
$table.prev('table.sticky-header').addBack().find('th.select-all input[type="checkbox"]').each(function () {
- $(this).attr('title', state ? strings.selectNone : strings.selectAll);
+ var $checkbox = $(this);
+ var stateChanged = $checkbox.prop('checked') !== state;
+
+ $checkbox.attr('title', state ? strings.selectNone : strings.selectAll);
/**
- * @this {HTMLElement}
+ * @checkbox {HTMLElement}
*/
- this.checked = state;
+ if (stateChanged) {
+ $checkbox.prop('checked', state).trigger('change');
+ }
});
};
@@ -57,18 +62,22 @@
// Loop through all checkboxes and set their state to the select all
// checkbox' state.
checkboxes.each(function () {
+ var $checkbox = $(this);
+ var stateChanged = $checkbox.prop('checked') !== event.target.checked;
/**
- * @this {HTMLElement}
+ * @checkbox {HTMLElement}
*/
- this.checked = event.target.checked;
+ if (stateChanged) {
+ $checkbox.prop('checked', event.target.checked).trigger('change');
+ }
// Either add or remove the selected class based on the state of the
// check all checkbox.
/**
- * @this {HTMLElement}
+ * @checkbox {HTMLElement}
*/
- $(this).closest('tr').toggleClass('selected', this.checked);
+ $checkbox.closest('tr').toggleClass('selected', this.checked);
});
// Update the title and the state of the check all box.
updateSelectAll(event.target.checked);