D
DL
Here's the thing, I have this HTML Table, that has multile rows
already, each has an ID, one of them at the bottom section has id of
"SaveData", new TRs are dynamically created upon user interaction, for
instance,
var tbl = document.getElementById ('mytable');
// pick a TR position to insert a new row
var trPos = 6
newTR = tbl.insertRow(trPos);
// then increment the trPos var
// other business rules and functions...
it works all right for a few TR insertions, and then, it begins to
insert a new TR after "SaveData",
that's bad. So, the question is, is there any way to use
tbl.insertRow(trPos) in conjunction with
insertBefore(document.getElementById('SaveData'))
that would ensure every newly inserted TR would be inserted before
"SaveData" TR?
I've looked at insertAdjacentElement method, but that does not seem to
solve the problem.
Sorry I have to ask the question before I got a good js book. Thanks.
already, each has an ID, one of them at the bottom section has id of
"SaveData", new TRs are dynamically created upon user interaction, for
instance,
var tbl = document.getElementById ('mytable');
// pick a TR position to insert a new row
var trPos = 6
newTR = tbl.insertRow(trPos);
// then increment the trPos var
// other business rules and functions...
it works all right for a few TR insertions, and then, it begins to
insert a new TR after "SaveData",
that's bad. So, the question is, is there any way to use
tbl.insertRow(trPos) in conjunction with
insertBefore(document.getElementById('SaveData'))
that would ensure every newly inserted TR would be inserted before
"SaveData" TR?
I've looked at insertAdjacentElement method, but that does not seem to
solve the problem.
Sorry I have to ask the question before I got a good js book. Thanks.