Merge pull request #32 from balloob/fix-remove-file

Fix removing a file
This commit is contained in:
Adwait 2022-07-19 12:19:15 +05:30 committed by GitHub
commit 54cf664537
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -170,22 +170,15 @@ addFile.onclick = () => {
element4.setAttribute('class', "btn");
element4.setAttribute('value', 'Remove'); // or element1.value = "button";
element4.onclick = function() {
removeRow(btnName);
removeRow(row);
}
cell4.appendChild(element4);
}
}
function removeRow(btnName) {
var rowCount = table.rows.length;
for (var i = 0; i < rowCount; i++) {
var row = table.rows[i];
var rowObj = row.cells[2].childNodes[0];
if (rowObj.name == btnName) {
table.deleteRow(i);
rowCount--;
}
}
function removeRow(row) {
const rowIndex = Array.from(table.rows).indexOf(row);
table.deleteRow(rowIndex);
}
// to be called on disconnect - remove any stale references of older connections if any