0

I am using Tablesorter and a mod of Tablesorter

  1. http://tablesorter.com/docs/
  2. http://www.pengoworks.com/workshop/jquery/tablesorter/tablesorter.htm

I have a pretty simple question. In the mod functionality, how can I display the total visible row count above the table? I understand it will require a textbox to display the result, but how do I get that value? It should display something like, "total rows retrieved: 100".

4

2 回答 2

2

您可以只添加一个标题行:

<tr>
    <th colspan="6" class="total">
        Total Rows: <span>0</span>
    </th>
</tr>

然后输入信息,根本不需要tablesorter(演示

var totalrows = $('table tbody tr').length;
$('.total span').html(totalrows);​
于 2012-07-16T14:17:13.013 回答
1

使用了 fudgey 的逻辑,但希望我的总行在表之外,所以修改如下。

Total Rows: <span class="total"> 0  </span>
<table cellspacing="1" class="tablesorter"> 
....  </table>

javascript:Active 是我的 tr 行的类。

var totalrows = $('.Active').length;

$('.total').html(totalrows);   
于 2012-07-16T18:59:53.397 回答