Allow user to cancel all selection

This commit is contained in:
RubenPX 2022-05-03 12:52:26 +02:00
parent 9d9514e68b
commit 2aab4b49d3
1 changed files with 3 additions and 2 deletions

View File

@ -89,7 +89,7 @@ window.addEventListener("DOMContentLoaded", () => {
${ ${
TableController.getAllDevices().length != TableController.getSelectedDevices().length TableController.getAllDevices().length != TableController.getSelectedDevices().length
? `<a href="#" class="ml-3">Select all devices (${TableController.getAllDevices().length})</a>` ? `<a href="#" class="ml-3">Select all devices (${TableController.getAllDevices().length})</a>`
: "" : "<a href=\"#\" class=\"ml-3\">Cancel selection</a>"
}`; }`;
alertInfoDevices.classList.remove("d-none"); alertInfoDevices.classList.remove("d-none");
} else if (isAllChecked.every(bool => bool == false)) { } else if (isAllChecked.every(bool => bool == false)) {
@ -113,7 +113,8 @@ window.addEventListener("DOMContentLoaded", () => {
}) })
alertInfoDevices.addEventListener("click", () => { alertInfoDevices.addEventListener("click", () => {
TableController.getAllDevices().forEach(ckeckbox => { ckeckbox.checked = true }); const checkState = TableController.getAllDevices().length == TableController.getSelectedDevices().length
TableController.getAllDevices().forEach(ckeckbox => { ckeckbox.checked = !checkState });
itemListCheckChanged() itemListCheckChanged()
}) })