Jerome
04-03-2003, 04:34 PM
Hi,
I like to sort the data from a table in alfhabetical order from a till z
On the moment i have it already working, however what i did was not so clever, because i change the data from the cells with innerHTML.
I simply loop through all records and determine with innerHTML if data > yes or no, if so I change the data from the cell.
Instead I would like to change the complete rows, so when I have:
<tr id="1"><td id="a1">AAAAAA</td></tr>
<tr id="2"><td id="a2">CCCCCC</td></tr>
<tr id="3"><td id="a3">BBBBBB</td></tr>
The result needs to look like:
<tr id="1"><td id="a1">AAAAAA</td></tr>
<tr id="3"><td id="a3">BBBBBB</td></tr>
<tr id="2"><td id="a2">CCCCCC</td></tr>
I already determine the data, but how can i change the rows?
document.getElementsByTagName('tr') where document.getElementById(row-number)
Hmm. not sure how to achieve this
Thanks a lot,
Jerome
I like to sort the data from a table in alfhabetical order from a till z
On the moment i have it already working, however what i did was not so clever, because i change the data from the cells with innerHTML.
I simply loop through all records and determine with innerHTML if data > yes or no, if so I change the data from the cell.
Instead I would like to change the complete rows, so when I have:
<tr id="1"><td id="a1">AAAAAA</td></tr>
<tr id="2"><td id="a2">CCCCCC</td></tr>
<tr id="3"><td id="a3">BBBBBB</td></tr>
The result needs to look like:
<tr id="1"><td id="a1">AAAAAA</td></tr>
<tr id="3"><td id="a3">BBBBBB</td></tr>
<tr id="2"><td id="a2">CCCCCC</td></tr>
I already determine the data, but how can i change the rows?
document.getElementsByTagName('tr') where document.getElementById(row-number)
Hmm. not sure how to achieve this
Thanks a lot,
Jerome