如何在数据表 1.9 的当前页面中显示 select 行?

How do i select rows displayed in current page in datatables 1.9?

我正在使用数据表 1.9 和 tabletool.js 2.1.5。 我总共有 23 条记录,每页 10 条记录。我要select当前显示的页面记录

我用过 TableTools.js 个按钮 (select_all)。但是这个 selects 数据表的所有行。 我试过了

$('#file-records> tbody > tr').each(function() {                                
   TableTools.fnGetInstance('file-records').fnSelect($(this));                                              
});

上面的代码报错 未捕获类型错误:无法读取未定义的 属性 'nTr'

我已经实现了以下

$('#file-records> tbody > tr').each(function() {
    $(this).addClass("active");
});

$(this).addClass("active");添加背景色:#017ebc,我已经在 css 文件中写入。

所以当你想获得选定的行值时,你可以

$('#file-records> tbody > tr').each(function() {
     if($(this).hasClass('active')){
     console.log($(this)[0]);
   }
});

$(this)[0] 是我的行属性,从中我们可以得到实际的行内容