JQuery TableSorter 2.25(Mottie 叉子)w/Scroller:以编程方式滚动到行?

JQuery TableSorter 2.25 (Mottie fork) w/ Scroller: Programmatically scroll to row?

我一直在使用 Mottie fork of the JQuery TableSorter plugin for a while now, and it's pretty phenomenal. I'm using the "scroller" widget 使 table 可以垂直和水平滚动,同时在左侧保留一些固定列。

问题来了:有没有办法以编程方式滚动到特定行?例如"myTable.scrollToRow(40)"?像素偏移也完全可以接受table。

我不确定使用什么界面允许用户滚动到特定行,但您可以使用以下代码设置滚动(demo):

HTML(用于演示)

Scroll to row: <button type="button">20</button> <button type="button">40</button>

脚本

$('button').click(function(){
    var $scroller = $('.tablesorter-scroller-table'),
    row = parseInt( $(this).text(), 10 ),
    position = $table.find('tbody tr').eq(row).position();
  $scroller.scrollTop( $scroller.scrollTop() + position.top );
});