|
Learn Java Script Today | | | Over 5000 Free Fonts | | | Tutorials | | | Javascript Forum | | | Other Javascript Resources | | | Cheat Sheet |
Table Sorting is a curtesy of WebFX This only works in Internet Explorer 5.0 Sorting With BehaviorsI decided to do a behavior of this script so that it would be even easier to use. Click at the table headers to test the sorting or click the button below the table.
What do I need to use thisYou need to download tablesort.htc file and assign it to a table using CSS. This can either be done in an inline style attribute or in a style block. Below are the two methods: <table style="behavior: url('tablesort.htc');">... <style> table {behavior: url("tablesort.htc");} </style> You should also organise your table into a table head and a table body. If it doesn't have this structure it will behave just like an ordinary table. The table should look like this: <table onclick="sortColumn(event)"> <thead> <tr>...</tr> ... </thead> <tbody> <tr>...</tr> ... </tbody> </table> You don't need to include a special CSS file but I recomend that you do it anyway because that the
arrow should use the webdings font. Download tablesort.css and add the
following line to the <link rel="STYLESHEET" type="text/css" href="tablesort.css"> Table MethodsI also created a method so that you can sort the table through scripting. This method is
called Defining the sort
|
|