Javascript Table sorter

The table sorter script is easy to use and feature packed at only 2.5KB. New features include column highlighting, optional pagination, support for links, and date/link parsing. A few other features are alternate row highlighting, header class toggling, auto data type recognition and selective column sorting.

To initialize a table sorter follow the pattern below:

var sorter = new TINY.table.sorter("sorter");

sorter.head = “head”; //header class name

sorter.asc = “asc”; //ascending header class name

sorter.desc = “desc”; //descending header class name

sorter.even = “evenrow”; //even row class name

sorter.odd = “oddrow”; //odd row class name

sorter.evensel = “evenselected”; //selected column even class

sorter.oddsel = “oddselected”; //selected column odd class

sorter.paginate = true (false); //toggle for pagination logic

sorter.pagsize = 15 (20); //toggle for pagination logic

sorter.currentid = “currentpage”; //current page id

sorter.limitid = “pagelimit”; //page limit id

sorter.init(“table”,1);

Before initialization, a new table sorter object must be created. The parameter taken by TINY.table.sorter is the variable name used for the object. The object.init function takes 2 parameters: the id of the table and the initially sorted column index (optional). If you want to exclude a column from sorting add class=”nosort” to the appropriate table header. Table styling is completely customizable via the CSS.

TinyTable has been tested in Firefox 2/3, IE 6/7, Opera, Safari and Chrome.

Click here for demo

Click here for download

Re-blog [source]

3 Comments

  1. Great site this vishalgadkari.com and I am really pleased to see you have what I am actually looking for here and this this post is exactly what I am interested in. I shall be pleased to become a regular visitor 🙂

    April 4, 2009
  2. vishal said:

    Thanks alot .. Do tell me what more would u like to see on my blog .

    April 6, 2009
  3. turacrear said:

    hmm… informative.

    April 12, 2009

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.