Check scopes checkboxes recursively

Otherwise, nested scopes are not checked and mislead users.

When a scope is checked, we search all its children and check them too.
multi-ogserver
Javier Sánchez Parra 2022-01-31 11:47:40 +01:00
parent 9a6508c686
commit 5d9ad78ed3
2 changed files with 14 additions and 0 deletions

View File

@ -9,6 +9,19 @@ function storeCheckboxStatus(checkbox) {
localStorage.removeItem(checkbox.name);
}
function checkChildrenCheckboxes() {
const checkboxes = $('input:checkbox[form|="scopesForm"]')
checkboxes.on('change', function () {
const checked = this.checked
const children = $('input:checkbox', this.parentNode).not(this)
children.each(function () {
this.checked = checked;
storeCheckboxStatus(this);
});
});
}
function keepSelectedClients() {
const checkboxes = $('input:checkbox[form|="scopesForm"]')

View File

@ -11,6 +11,7 @@
updateScopeState();
keepScopesTreeState();
keepSelectedClients();
checkChildrenCheckboxes();
}
});
</script>