Varanasi Benares
Varanasi Benares

Reputation: 400

Using JQuery tablesorter with emptyTo to properly sort empty fields

I have been struggling to get the tablesorter emptyTo parameter to properly sort empty fields. What I would like is to keep all the empty cells on the bottom of the sorted column, which I believe is the default behavior.

The official description of how to do this is here: https://mottie.github.io/tablesorter/docs/example-option-sort-empty.html.

I believe I am using code that is very close to the official example, but I simply cannot make it work.

Here's the code I am using:

$(function() 
{ 
    $("#myTable").tablesorter({
        sortList: [[1,1]],
         emptyTo: 'bottom'
                               }); 
}); 

The sort order parameter works and the table is sortable by column, but I cannot get the empty fields to behave as the emptyTo parameter instructs them to -- I have tried all the example values.

There's a test case here: http://shootredtanks.com/test/award_list.html

Upvotes: 1

Views: 233

Answers (1)

K Scandrett
K Scandrett

Reputation: 16540

The version of tablesorter you are using in http://shootredtanks.com/test/award_list.html is old (2.0.5b), you need to upgrade to a later version to fix this issue.

A working example using the latest version http://plnkr.co/edit/rRMWUb2Gj5niy01Ah3wL?p=info (which didn't work using your version).

This one uses:

/*! TableSorter (FORK) v2.28.4 *//*
* Client-side table sorting with ease!
* @requires jQuery v1.2.6+

Upvotes: 2

Related Questions