Check initial state on dom loaded & check if has devices

This commit is contained in:
RubenPX 2022-05-11 11:19:56 +02:00
parent d27cc46f64
commit cc7b453c06
1 changed files with 9 additions and 0 deletions

View File

@ -104,6 +104,13 @@ window.addEventListener("DOMContentLoaded", () => {
btnSelectAll.checked = false; btnSelectAll.checked = false;
btnSelectAll.indeterminate = false; btnSelectAll.indeterminate = false;
} }
if (TableController.getAllDevices().length == 0) {
btnSelectAll.checked = false;
btnSelectAll.disabled = true;
} else {
btnSelectAll.disabled = false;
}
} }
TableController.getAllDevices().forEach(item => { TableController.getAllDevices().forEach(item => {
@ -126,6 +133,8 @@ window.addEventListener("DOMContentLoaded", () => {
table.on("datatable.page", () => itemListCheckChanged()); table.on("datatable.page", () => itemListCheckChanged());
table.on("datatable.perpage", () => itemListCheckChanged()); table.on("datatable.perpage", () => itemListCheckChanged());
table.on("datatable.update", () => itemListCheckChanged()); table.on("datatable.update", () => itemListCheckChanged());
itemListCheckChanged();
}) })
function deviceSelect() { function deviceSelect() {