I am a beginner. The sort.js works great after I added a setDataType function. How can I (when the column header is clicked) sort or reverse the column data. I replaced the column.sort with column.reverse and it works but only for the first column. No matter which column header is clicked.
i want mack a color Array table in Javascript.wasim June 7, 2011 at 11:45 AM
<H2>JavaScript Sort Table</H2> <SCRIPT type="text/javascript" src="sort.js"></SCRIPT> <TABLE WIDTH="55%" BORDER="1" name="table" id="table" cols="4"> <TR><TD><A href="javascript:sortTable(0, table);"><FONT color="red"><B>ID</FONT></B></A></TD> <TD><A href="javascript:sortTable(1, table);"><FONT color="red"><B>NAME</FONT></B></A></TD> <TD><A href="javascript:sortTable(2, table);"><FONT color="red"><B>ADDRESS</FONT></B></A></TD> <TD><A href="javascript:sortTable(3, table);"><FONT color="red"><B>SPECIALIZATION</FONT></B></A> </TD></TR></FONT> <TR><TD>1</TD><TD>Angelina</TD><TD>Delhi</TD><TD>Computer Science</TD></TR> <TR><TD>2</TD><TD>Martina</TD><TD>Lucknow</TD><TD>Mathematics</TD></TR> <TR><TD>3</TD><TD>Tina</TD><TD>Chennai</TD><TD>English</TD></TR> <TR><TD>4</TD><TD>Simran</TD><TD>Mumbai</TD><TD>Biology</TD></TR> <TR><TD>5</TD><TD>Christina</TD><TD>Kolkata</TD><TD>Psychology</TD></TR> </TABLE>
sort numericB Herbert October 18, 2012 at 6:48 PM
I was able to make your code work nicely except some of my columns are numeric. Example: If Christina was ID=15 the id column would not sort correctly
reverse methodb herbert October 24, 2012 at 9:45 PM
I am a beginner. The sort.js works great after I added a setDataType function. How can I (when the column header is clicked) sort or reverse the column data. I replaced the column.sort with column.reverse and it works but only for the first column. No matter which column header is clicked.
Post your Comment