Group, I have a table that is dynamically built with device ids. I have a "swapCell" that moves the cells up and down when the user clicks on (up/dwn) buttons. I have a delete row function that deletes current row.
-Problem is: If I have six rows (1,2,3,4,5,6) and six id's (id=row1,id=row2,id=row3,id=row4,id=row5,id=row6)
-And delete "row 2 and row 4" I have new rows (1,2,3,4) and new (id=row1,id=row3,id=row5,id=row6)
-But I would like to have "id's" the same as row number after I delete that current row.
function swapcells(idA,idB){
var cellA=document.getElementById('cell'+idA);
var cellB=document.getElementById('cell'+idB);
if(cellA&&cellB){
var temp=cellA.innerHTML;
cellA.innerHTML=cellB.innerHTML;
cellB.innerHTML=temp;
}
}
function deleteRows(rowObjArray){
if (hasLoaded) {
for (var i=0; i<rowObjArray.length; i++) {
var rIndex = rowObjArray[i].sectionRowIndex;
rowObjArray[i].parentNode.deleteRow(rIndex);
}
}
}