Merge pull request #32 from balloob/fix-remove-file
Fix removing a file
This commit is contained in:
commit
54cf664537
15
index.js
15
index.js
@ -170,22 +170,15 @@ addFile.onclick = () => {
|
|||||||
element4.setAttribute('class', "btn");
|
element4.setAttribute('class', "btn");
|
||||||
element4.setAttribute('value', 'Remove'); // or element1.value = "button";
|
element4.setAttribute('value', 'Remove'); // or element1.value = "button";
|
||||||
element4.onclick = function() {
|
element4.onclick = function() {
|
||||||
removeRow(btnName);
|
removeRow(row);
|
||||||
}
|
}
|
||||||
cell4.appendChild(element4);
|
cell4.appendChild(element4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeRow(btnName) {
|
function removeRow(row) {
|
||||||
var rowCount = table.rows.length;
|
const rowIndex = Array.from(table.rows).indexOf(row);
|
||||||
for (var i = 0; i < rowCount; i++) {
|
table.deleteRow(rowIndex);
|
||||||
var row = table.rows[i];
|
|
||||||
var rowObj = row.cells[2].childNodes[0];
|
|
||||||
if (rowObj.name == btnName) {
|
|
||||||
table.deleteRow(i);
|
|
||||||
rowCount--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// to be called on disconnect - remove any stale references of older connections if any
|
// to be called on disconnect - remove any stale references of older connections if any
|
||||||
|
Loading…
Reference in New Issue
Block a user