Fix use table library api instead replace content

https://github.com/fiduswriter/Simple-DataTables
This commit is contained in:
RubenPX 2022-04-12 11:39:53 +02:00
parent c910e0f7c0
commit 3ab7e8796f
1 changed files with 9 additions and 1 deletions

View File

@ -367,7 +367,15 @@ async function processSelectedDevices() {
var tmpDiv = document.createElement("div")
tmpDiv.innerHTML = newRequest
document.querySelector("table.table > tbody").innerHTML = tmpDiv.querySelector("table.table > tbody").innerHTML
var oldTable = Array.from(document.querySelectorAll("table.table > tbody > tr .deviceSelect")).map(x => x.attributes["data-device-dhid"].value)
var newTable = Array.from(tmpDiv.querySelectorAll("table.table > tbody > tr .deviceSelect")).map(x => x.attributes["data-device-dhid"].value)
for (let i = 0; i < oldTable.length; i++) {
if (!newTable.includes(oldTable[i])) {
// variable from device_list.html --> See: ereuse_devicehub\templates\inventory\device_list.html (Ln: 411)
table.rows().remove(i)
}
}
}
}