A
awebguynow
Most JS people have seen sorttable.js and similar implementations.
I'm trying to do a SubSelect of an existing table, restricting values
in a Column to spec. range.
Rows manipulated through sorttable are not copies of the row objects,
they are ref's to the tbl row. Therefore care must be taken not to
delete them if they are needed, etc.
I'm getting used to the API:
tbody.deleteRow(rowIndex)
tbody.insertBefore(oRowI, oRowJ);
tbody.replaceChild(oRowI, oRowJ);
tbody.appendChild(row)
At some point during sort, the rowIndex gets re-ordered, I'm just not
sure when.
One strange result in my testing (possibly programmer error) of
deleteRow()
for (var k=0; k<telem.tBodies[0].rows.length; k++)
telem.tBodies[0].deleteRow(k);
Seemed to only delete aprx. 1/2 of the rows, must be because length was
changing
I had better results using starting with length and using decrement
k--
http://terrill.ca/sorting/ had good ref to "Exchanging HTML Table
Rows"
and also covered the gotcha topic of problems exchanging rows when one
is the last row and becomes undefined [ this I dodn't fully understand
yet ] occurs when rows have non-consecutive rowIndex's
Has anyone come on similar problems or have a better understanding of
this ?
There's certainly some nuances involved.
I'm trying to do a SubSelect of an existing table, restricting values
in a Column to spec. range.
Rows manipulated through sorttable are not copies of the row objects,
they are ref's to the tbl row. Therefore care must be taken not to
delete them if they are needed, etc.
I'm getting used to the API:
tbody.deleteRow(rowIndex)
tbody.insertBefore(oRowI, oRowJ);
tbody.replaceChild(oRowI, oRowJ);
tbody.appendChild(row)
At some point during sort, the rowIndex gets re-ordered, I'm just not
sure when.
One strange result in my testing (possibly programmer error) of
deleteRow()
for (var k=0; k<telem.tBodies[0].rows.length; k++)
telem.tBodies[0].deleteRow(k);
Seemed to only delete aprx. 1/2 of the rows, must be because length was
changing
I had better results using starting with length and using decrement
k--
http://terrill.ca/sorting/ had good ref to "Exchanging HTML Table
Rows"
and also covered the gotcha topic of problems exchanging rows when one
is the last row and becomes undefined [ this I dodn't fully understand
yet ] occurs when rows have non-consecutive rowIndex's
Has anyone come on similar problems or have a better understanding of
this ?
There's certainly some nuances involved.