JQuery tablesorter problem

前端 未结 6 2133
孤城傲影
孤城傲影 2021-02-01 07:13

I\'m having a couple of problems with the JQuery tablesorter plugin. If you click on a column header, it should sort the data by this column, but there are a couple of problems:

6条回答
  •  春和景丽
    2021-02-01 07:51

    I found that the following will work with unrecognized numeric (digit) columns. It appears that 0 is considered text by the current version (2.0.3) of tablesorter.

    Including the sample from tvanfosson, this script at the bottom of your page would move your last row from the footer which prevents it from being sorted with the data within tbody and would force the sorter to use a numeric sort rather than the text sort it is using as you described.

    $(document).ready(function() {
      $('#communityStats').append("");
      $('#communityStats > tr:last').remove()
        .appendTo('#communityStats > tfoot');
    
      $("#communityStats").tablesorter({
         debug: true,
         headers: { 
           0:{sorter: 'digit'}
           ...
           10:{sorter: 'digit'}
         }
      });
    
    }); 
    

提交回复
热议问题