Skip to content
Snippets Groups Projects
Commit 07d9c12e authored by Chris Lawton's avatar Chris Lawton Committed by Todd Dembrey
Browse files

reset the check all input if all were selected and then one was unselected

parent ecf85e0c
No related branches found
No related tags found
No related merge requests found
......@@ -7,30 +7,36 @@
const $allCheckboxInput = $('.js-batch-select-all');
const activeClass = 'batch-actions-enabled';
$allCheckboxInput.change(function() {
$allCheckboxInput.change(function () {
if ($(this).is(':checked')) {
$checkbox.each(function() {
$checkbox.each(function () {
this.checked = true;
});
} else {
$checkbox.each(function() {
}
else {
$checkbox.each(function () {
this.checked = false;
});
}
updateCount();
})
});
$checkbox.change(function () {
// see how many checkboxes are :checked
checkTotalSelected();
toggleBatchActions();
// updates selected checbox count
updateCount();
// reset the check all input
if (!$(this).is(':checked') && $allCheckboxInput.is(':checked')) {
resetCheckAllInput();
}
});
function checkTotalSelected() {
function toggleBatchActions() {
if ($('.js-batch-select:checked').length) {
$body.addClass(activeClass);
}
......@@ -43,6 +49,10 @@
$('.js-total-actions').html($('.js-batch-select:checked').length);
}
function resetCheckAllInput() {
$allCheckboxInput.prop('checked', false);
}
})(jQuery);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment