Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
7.4.0
-
Patch
Description
When using a CheckGroupSelector and your list of Check objects is empty, the default selection state for the select all checkbox is true, when it should be false. If there are no check boxes in the list, by extension none are 'checked'; therefore the select all check box should reflect this and not be checked by default.
I believe the problem is in CheckSelector.updateSelectorState():
updateSelectorState: function(selectorId, findCheckboxes) { var checkboxes = findCheckboxes(), allChecked = true; for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].disabled === false) && (checkboxes[i].checked === false)) { allChecked = false; break; } } var selector = document.getElementById(selectorId); selector.checked = allChecked; }
If findCheckboxes() returns null or an empty list, the loop never executes and the allChecked variable remains set to true. A simple empty/null check on the list to determine the original value of the allChecked variable should do the trick:
allChecked = checkboxes !== null && checkboxes.length > 0;