Fix reactivity un variables

avoid outdated data variable
This commit is contained in:
RubenPX 2022-04-29 13:58:48 +02:00
parent 7503895a4f
commit b88a514edf
1 changed files with 5 additions and 5 deletions

View File

@ -18,9 +18,9 @@ $(document).ready(() => {
}) })
class TableController { class TableController {
static #tableRows = table.rows().dt.activeRows; static #tableRows = table.activeRows;
static #tableRowsPage = table.rows().dt.pages[table.rows().dt.currentPage - 1]; static #tableRowsPage = () => table.pages[table.rows().dt.currentPage - 1];
/** /**
* @returns Selected inputs from device list * @returns Selected inputs from device list
@ -35,7 +35,7 @@ class TableController {
* @returns Selected inputs in current page from device list * @returns Selected inputs in current page from device list
*/ */
static getAllSelectedDevicesInCurrentPage() { static getAllSelectedDevicesInCurrentPage() {
return this.#tableRowsPage return this.#tableRowsPage()
.filter(element => element.querySelector("input").checked) .filter(element => element.querySelector("input").checked)
.map(element => element.querySelector("input")) .map(element => element.querySelector("input"))
} }
@ -52,7 +52,7 @@ class TableController {
* @returns All inputs from current page in device list * @returns All inputs from current page in device list
*/ */
static getAllDevicesInCurrentPage() { static getAllDevicesInCurrentPage() {
return this.#tableRows return this.#tableRowsPage()
.map(element => element.querySelector("input")) .map(element => element.querySelector("input"))
} }