
JQuery::TableSorter - The JQuery TableSorter

use JQuery ;
use JQuery::TableSorter ;
# define JQuery
my $jquery = new JQuery ;
# Create data for the table
my $data = [['Id','Total','Ip','Time','US Short Date','US Long Date'],
['66672', '$22.79','172.78.200.124','08:02','12-24-2000','Jul 6, 2006 8:14 AM'],
['66672','$2482.79','172.78.200.124','15:10','12-12-2001','Jan 6, 2006 8:14 AM'],
['66672', '$22.79','172.78.200.124','08:02','12-24-2000','Jul 6, 2006 8:14 AM'],
['66672','$2482.79','172.78.200.124','15:10','12-12-2001','Jan 6, 2006 8:14 AM']
] ;
$jquery->add_css(new JQuery::CSS( hash => {
'#table1' => {width => '900px', 'font-size' => '15px'}
})) ;
# Create a TableSorter, add it to JQuery, and get the result as HTML
my $tableHTML = JQuery::TableSorter->new(id => 'table1',
addToJQuery => $jquery,
data => $data,
dateFormat=>'dd/mm/yyyy',
sortColumn => 'Total',
sortClassAsc => 'headerSortUp',
sortClassDesc => 'headerSortDown',
headerClass => 'header',
stripingRowClass => ['even','odd'],
stripRowsOnStartUp => 'true',
#highlightClass => 'highlight',
disableHeader => 'true'
))->HTML ;
# Get the JQuery code
my $code = $jquery->get_jquery_code ;
# Get the CSS
my $css = $jquery->get_css ;
# All that needs to be done is to place the html, jquery code and css in a template

This module defines a table which is sorted when the user clicks the header. There are two builtin styles, to use them you have to set:
headerClass => 'header',
sortClassAsc => 'headerSortUp',
sortClassDesc => 'headerSortDown',
or
headerClass => 'headerSimple',
sortClassAsc => 'headerSimpleSortUp',
sortClassDesc => 'headerSimpleSortDown',
To see them, run the jquery_tablesorter1.pl and jquery_tablesorter2.pl examples.
In any event, you can always add CSS afterwards to change the appearance.
This module is based on the JQuery TableSorter. Definitive information for TableSorter can be found at http://motherrussia.polyester.se/jquery-plugins/tablesorter/. Examples can be found at http://motherrussia.polyester.se/pub/jquery/tablesorter/1.0.3/docs/.



Peter Gordon, <peter at pg-consultants.com>

Please report any bugs or feature requests to bug-jquery-taconite at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JQuery. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can find documentation for this module with the perldoc command.
perldoc JQuery
You can also look for information at:


Copyright 2007 Peter Gordon, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.