Monday 1 August 2011

Table Sorting Jquery plugin

The sorting of the data has become quiet easy using jquery plugin.Here goes the sample code to sort  the table.

Include the jquery and Jquery.tablesorter js files.



any related selector can be used for the container,in the above piece of code DATA_TABLE1 is the id of the table.


Parser[i] is undefined 


Case 1:


I've encountered the above error while trying to sort and the reason for the error was there were some empty
<tr> tags present in the table(since,I was using dynamic creation of the table empty <tr> tags sneaked in and on removal of them it  went on fine)


Case 2:


The same error can happen when trying to sort a empty table and be sure that if you are creating the container(dynamically),the sort is applied once the table is filled up.






Cheers and Happy Coding  :-)

2 comments:

  1. What about empty td's or empty cells?

    ReplyDelete
  2. empty td's are considered when u sort the columns with empty cells...the empty cells happen first and then a,b,c and in the other case the empty cells happens at last !!


    Cheers..... ;-)

    ReplyDelete