The following 100 line table has a className of “sortable-onload-3” which initiates an automatic sort on the third sortable column after the window.onload event fires (in this case, the column “Distributor”). Additionally, none of the columns have been given an explicit sort algorithm to use and so the script attempts to determine the datatype dynamically.
| Release Date | Movie | Distributor | Budget | US Gross | Worldwide Gross | My (Fake) Rating |
|---|---|---|---|---|---|---|
| 06/30/2004 | Spider-Man 2 | Columbia | $200,000,000 | $373,524,485 | $783,524,485 | 10 |
| 12/19/1997 | Titanic | 20th Century Fox | $200,000,000 | $600,788,188 | $1,835,400,000 | 9.2 |
| 06/30/1999 | Wild Wild West | Warner Bros. | $175,000,000 | $113,805,681 | $217,700,000 | 2.5 |
| 07/28/1995 | Waterworld | Universal | $175,000,000 | $88,246,220 | $255,200,000 | 3.8 |
| 05/07/2004 | Van Helsing | Universal | $170,000,000 | $120,150,546 | $269,150,546 | 3.7 |
| 07/01/2003 | Terminator 3: Rise of the Machines | Warner Bros. | $170,000,000 | $150,358,296 | $433,058,296 | 2.2 |
| 11/10/2004 | Polar Express, The | Warner Bros. | $170,000,000 | $162,753,127 | $281,351,972 | 6.6 |
| 11/24/2004 | Alexander | Warner Bros. | $155,000,000 | $34,297,191 | $164,297,191 | 0 |
| 06/15/2005 | Batman Begins | Warner Bros. | $150,000,000 | $205,343,774 | $371,824,647 | 4.9 |
| 07/15/2005 | Charlie and the Chocolate Factory | Warner Bros. | $150,000,000 | $206,278,008 | $467,278,008 | 8.1 |
| 06/30/2004 | Spider-Man 2 | Columbia | $200,000,000 | $373,524,485 | $783,524,485 | 10 |
| 12/19/1997 | Titanic | 20th Century Fox | $200,000,000 | $600,788,188 | $1,835,400,000 | 9.2 |
| 06/30/1999 | Wild Wild West | Warner Bros. | $175,000,000 | $113,805,681 | $217,700,000 | 2.5 |
| 07/28/1995 | Waterworld | Universal | $175,000,000 | $88,246,220 | $255,200,000 | 3.8 |
| 05/07/2004 | Van Helsing | Universal | $170,000,000 | $120,150,546 | $269,150,546 | 3.7 |
| 07/01/2003 | Terminator 3: Rise of the Machines | Warner Bros. | $170,000,000 | $150,358,296 | $433,058,296 | 2.2 |
| 11/10/2004 | Polar Express, The | Warner Bros. | $170,000,000 | $162,753,127 | $281,351,972 | 6.6 |
| 11/24/2004 | Alexander | Warner Bros. | $155,000,000 | $34,297,191 | $164,297,191 | 0 |
| 06/15/2005 | Batman Begins | Warner Bros. | $150,000,000 | $205,343,774 | $371,824,647 | 4.9 |
| 07/15/2005 | Charlie and the Chocolate Factory | Warner Bros. | $150,000,000 | $206,278,008 | $467,278,008 | 8.1 |
| 06/30/2004 | Spider-Man 2 | Columbia | $200,000,000 | $373,524,485 | $783,524,485 | 10 |
| 12/19/1997 | Titanic | 20th Century Fox | $200,000,000 | $600,788,188 | $1,835,400,000 | 9.2 |
| 06/30/1999 | Wild Wild West | Warner Bros. | $175,000,000 | $113,805,681 | $217,700,000 | 2.5 |
| 07/28/1995 | Waterworld | Universal | $175,000,000 | $88,246,220 | $255,200,000 | 3.8 |
| 05/07/2004 | Van Helsing | Universal | $170,000,000 | $120,150,546 | $269,150,546 | 3.7 |
| 07/01/2003 | Terminator 3: Rise of the Machines | Warner Bros. | $170,000,000 | $150,358,296 | $433,058,296 | 2.2 |
| 11/10/2004 | Polar Express, The | Warner Bros. | $170,000,000 | $162,753,127 | $281,351,972 | 6.6 |
| 11/24/2004 | Alexander | Warner Bros. | $155,000,000 | $34,297,191 | $164,297,191 | 0 |
| 06/15/2005 | Batman Begins | Warner Bros. | $150,000,000 | $205,343,774 | $371,824,647 | 4.9 |
| 07/15/2005 | Charlie and the Chocolate Factory | Warner Bros. | $150,000,000 | $206,278,008 | $467,278,008 | 8.1 |
| 06/30/2004 | Spider-Man 2 | Columbia | $200,000,000 | $373,524,485 | $783,524,485 | 10 |
| 12/19/1997 | Titanic | 20th Century Fox | $200,000,000 | $600,788,188 | $1,835,400,000 | 9.2 |
| 06/30/1999 | Wild Wild West | Warner Bros. | $175,000,000 | $113,805,681 | $217,700,000 | 2.5 |
| 07/28/1995 | Waterworld | Universal | $175,000,000 | $88,246,220 | $255,200,000 | 3.8 |
| 05/07/2004 | Van Helsing | Universal | $170,000,000 | $120,150,546 | $269,150,546 | 3.7 |
| 07/01/2003 | Terminator 3: Rise of the Machines | Warner Bros. | $170,000,000 | $150,358,296 | $433,058,296 | 2.2 |
| 11/10/2004 | Polar Express, The | Warner Bros. | $170,000,000 | $162,753,127 | $281,351,972 | 6.6 |
| 11/24/2004 | Alexander | Warner Bros. | $155,000,000 | $34,297,191 | $164,297,191 | 0 |
| 06/15/2005 | Batman Begins | Warner Bros. | $150,000,000 | $205,343,774 | $371,824,647 | 4.9 |
| 07/15/2005 | Charlie and the Chocolate Factory | Warner Bros. | $150,000,000 | $206,278,008 | $467,278,008 | 8.1 |
| 06/30/2004 | Spider-Man 2 | Columbia | $200,000,000 | $373,524,485 | $783,524,485 | 10 |
| 12/19/1997 | Titanic | 20th Century Fox | $200,000,000 | $600,788,188 | $1,835,400,000 | 9.2 |
| 06/30/1999 | Wild Wild West | Warner Bros. | $175,000,000 | $113,805,681 | $217,700,000 | 2.5 |
| 07/28/1995 | Waterworld | Universal | $175,000,000 | $88,246,220 | $255,200,000 | 3.8 |
| 05/07/2004 | Van Helsing | Universal | $170,000,000 | $120,150,546 | $269,150,546 | 3.7 |
| 07/01/2003 | Terminator 3: Rise of the Machines | Warner Bros. | $170,000,000 | $150,358,296 | $433,058,296 | 2.2 |
| 11/10/2004 | Polar Express, The | Warner Bros. | $170,000,000 | $162,753,127 | $281,351,972 | 6.6 |
| 11/24/2004 | Alexander | Warner Bros. | $155,000,000 | $34,297,191 | $164,297,191 | 0 |
| 06/15/2005 | Batman Begins | Warner Bros. | $150,000,000 | $205,343,774 | $371,824,647 | 4.9 |
| 07/15/2005 | Charlie and the Chocolate Factory | Warner Bros. | $150,000,000 | $206,278,008 | $467,278,008 | 8.1 |
| 06/30/2004 | Spider-Man 2 | Columbia | $200,000,000 | $373,524,485 | $783,524,485 | 10 |
| 12/19/1997 | Titanic | 20th Century Fox | $200,000,000 | $600,788,188 | $1,835,400,000 | 9.2 |
| 06/30/1999 | Wild Wild West | Warner Bros. | $175,000,000 | $113,805,681 | $217,700,000 | 2.5 |
| 07/28/1995 | Waterworld | Universal | $175,000,000 | $88,246,220 | $255,200,000 | 3.8 |
| 05/07/2004 | Van Helsing | Universal | $170,000,000 | $120,150,546 | $269,150,546 | 3.7 |
| 07/01/2003 | Terminator 3: Rise of the Machines | Warner Bros. | $170,000,000 | $150,358,296 | $433,058,296 | 2.2 |
| 11/10/2004 | Polar Express, The | Warner Bros. | $170,000,000 | $162,753,127 | $281,351,972 | 6.6 |
| 11/24/2004 | Alexander | Warner Bros. | $155,000,000 | $34,297,191 | $164,297,191 | 0 |
| 06/15/2005 | Batman Begins | Warner Bros. | $150,000,000 | $205,343,774 | $371,824,647 | 4.9 |
| 07/15/2005 | Charlie and the Chocolate Factory | Warner Bros. | $150,000,000 | $206,278,008 | $467,278,008 | 8.1 |
| 06/30/2004 | Spider-Man 2 | Columbia | $200,000,000 | $373,524,485 | $783,524,485 | 10 |
| 12/19/1997 | Titanic | 20th Century Fox | $200,000,000 | $600,788,188 | $1,835,400,000 | 9.2 |
| 06/30/1999 | Wild Wild West | Warner Bros. | $175,000,000 | $113,805,681 | $217,700,000 | 2.5 |
| 07/28/1995 | Waterworld | Universal | $175,000,000 | $88,246,220 | $255,200,000 | 3.8 |
| 05/07/2004 | Van Helsing | Universal | $170,000,000 | $120,150,546 | $269,150,546 | 3.7 |
| 07/01/2003 | Terminator 3: Rise of the Machines | Warner Bros. | $170,000,000 | $150,358,296 | $433,058,296 | 2.2 |
| 11/10/2004 | Polar Express, The | Warner Bros. | $170,000,000 | $162,753,127 | $281,351,972 | 6.6 |
| 11/24/2004 | Alexander | Warner Bros. | $155,000,000 | $34,297,191 | $164,297,191 | 0 |
| 06/15/2005 | Batman Begins | Warner Bros. | $150,000,000 | $205,343,774 | $371,824,647 | 4.9 |
| 07/15/2005 | Charlie and the Chocolate Factory | Warner Bros. | $150,000,000 | $206,278,008 | $467,278,008 | 8.1 |
| 06/30/2004 | Spider-Man 2 | Columbia | $200,000,000 | $373,524,485 | $783,524,485 | 10 |
| 12/19/1997 | Titanic | 20th Century Fox | $200,000,000 | $600,788,188 | $1,835,400,000 | 9.2 |
| 06/30/1999 | Wild Wild West | Warner Bros. | $175,000,000 | $113,805,681 | $217,700,000 | 2.5 |
| 07/28/1995 | Waterworld | Universal | $175,000,000 | $88,246,220 | $255,200,000 | 3.8 |
| 05/07/2004 | Van Helsing | Universal | $170,000,000 | $120,150,546 | $269,150,546 | 3.7 |
| 07/01/2003 | Terminator 3: Rise of the Machines | Warner Bros. | $170,000,000 | $150,358,296 | $433,058,296 | 2.2 |
| 11/10/2004 | Polar Express, The | Warner Bros. | $170,000,000 | $162,753,127 | $281,351,972 | 6.6 |
| 11/24/2004 | Alexander | Warner Bros. | $155,000,000 | $34,297,191 | $164,297,191 | 0 |
| 06/15/2005 | Batman Begins | Warner Bros. | $150,000,000 | $205,343,774 | $371,824,647 | 4.9 |
| 07/15/2005 | Charlie and the Chocolate Factory | Warner Bros. | $150,000,000 | $206,278,008 | $467,278,008 | 8.1 |
| 06/30/2004 | Spider-Man 2 | Columbia | $200,000,000 | $373,524,485 | $783,524,485 | 10 |
| 12/19/1997 | Titanic | 20th Century Fox | $200,000,000 | $600,788,188 | $1,835,400,000 | 9.2 |
| 06/30/1999 | Wild Wild West | Warner Bros. | $175,000,000 | $113,805,681 | $217,700,000 | 2.5 |
| 07/28/1995 | Waterworld | Universal | $175,000,000 | $88,246,220 | $255,200,000 | 3.8 |
| 05/07/2004 | Van Helsing | Universal | $170,000,000 | $120,150,546 | $269,150,546 | 3.7 |
| 07/01/2003 | Terminator 3: Rise of the Machines | Warner Bros. | $170,000,000 | $150,358,296 | $433,058,296 | 2.2 |
| 11/10/2004 | Polar Express, The | Warner Bros. | $170,000,000 | $162,753,127 | $281,351,972 | 6.6 |
| 11/24/2004 | Alexander | Warner Bros. | $155,000,000 | $34,297,191 | $164,297,191 | 0 |
| 06/15/2005 | Batman Begins | Warner Bros. | $150,000,000 | $205,343,774 | $371,824,647 | 4.9 |
| 07/15/2005 | Charlie and the Chocolate Factory | Warner Bros. | $150,000,000 | $206,278,008 | $467,278,008 | 8.1 |
| 06/30/2004 | Spider-Man 2 | Columbia | $200,000,000 | $373,524,485 | $783,524,485 | 10 |
| 12/19/1997 | Titanic | 20th Century Fox | $200,000,000 | $600,788,188 | $1,835,400,000 | 9.2 |
| 06/30/1999 | Wild Wild West | Warner Bros. | $175,000,000 | $113,805,681 | $217,700,000 | 2.5 |
| 07/28/1995 | Waterworld | Universal | $175,000,000 | $88,246,220 | $255,200,000 | 3.8 |
| 05/07/2004 | Van Helsing | Universal | $170,000,000 | $120,150,546 | $269,150,546 | 3.7 |
| 07/01/2003 | Terminator 3: Rise of the Machines | Warner Bros. | $170,000,000 | $150,358,296 | $433,058,296 | 2.2 |
| 11/10/2004 | Polar Express, The | Warner Bros. | $170,000,000 | $162,753,127 | $281,351,972 | 6.6 |
| 11/24/2004 | Alexander | Warner Bros. | $155,000,000 | $34,297,191 | $164,297,191 | 0 |
| 06/15/2005 | Batman Begins | Warner Bros. | $150,000,000 | $205,343,774 | $371,824,647 | 4.9 |
| 07/15/2005 | Charlie and the Chocolate Factory | Warner Bros. | $150,000,000 | $206,278,008 | $467,278,008 | 8.1 |
The last column “Screening time” has been defined as using a custom sort function. This is stipulated by adding a class of “sortable-yourFunctionName” to the table header (TH) tag. In this case, the table header has been given the class “sortable-sortByTwelveHourTimestamp” which tells the script to use the function “sortByTwelveHourTimestamp” (View the page source to should you wish to view the function in question).
| Movie | Screening time |
|---|---|
| Spider-Man 2 | 4:32am |
| Titanic | 5:56am |
| Wild Wild West | 7:34 pm |
| Waterworld | 9:58pm |
| Van Helsing | 12:00pm |
| Terminator 3: Rise of the Machines | 12:10 p.m |
| Polar Express, The | 2:00pm |
| Alexander | Unknown |
| Batman Begins | Unknown |
| Charlie and the Chocolate Factory | 7:24am |
| Troy | 6:32am |
| Tarzan | Unknown |
| Die Another Day | 1:22am |
| Armageddon | 5:57pm |
| Men in Black 2 | 9:46pm |
| Lethal Weapon 4 | 9:56p.m. |
| Spider-Man | 4.32A.M. |
| Stealth | 12.32a.m |
| A tfoot that should not change | qwerty |
The following table uses a bespoke sort function named “sortImage” when sorting the first column. The function sorts the images using the value of their src attribute; which is itself parsed during the data preparation phase (using the function “sortImagePrepareData”). View the page source to see the two functions in question.
| Sort image | Description |
|---|---|
![]() |
The first image, named 2.jpg |
![]() |
The second image, named 3.jpg |
![]() |
The third image, named 1.jpg |
The script should only highlight and not sort the first column as it contains identical data.
| Identical data | Non sortable column | Sortable column |
|---|---|---|
| Some data | The first line | 100 |
| Some data | The second line | 300 |
| Some data | The third line | 200 |
View the related post or download the JavaScript source.