Can you make them table insertRow and insertBefore (element) work together?
- From: DL <tatata9999@xxxxxxxxx>
- Date: Fri, 30 May 2008 19:08:39 -0700 (PDT)
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.
.
- Follow-Ups:
- Prev by Date: Re: Array manipulation question
- Next by Date: Re: field value AFTER numeric validation
- Previous by thread: field value AFTER numeric validation
- Next by thread: Re: Can you make them table insertRow and insertBefore (element) work together?
- Index(es):