仅选择活动页面中的所有行 jquery 数据表 [英] Select all rows in active page only jquery Datatable

查看:16
本文介绍了仅选择活动页面中的所有行 jquery 数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 gidview 上使用 jquery 数据表,数据表标题上有一个复选框.该复选框的目的是选中gridview行的当前页面中的所有复选框.

I'm using jquery datatable on a gidview and there is a checkbox on the datatable header. The purpose of that checkbox is to check all checkboxes in the current page of the gridview rows.

所以我正在使用函数

var table = $('#Tab_ApplicantList').DataTable();
    var rows = $('#Tab_ApplicantList').dataTable().fnGetNodes();
    $(rows).each(function () {
        $(this).find("input.grey").iCheck('check');
    });

但问题是它选择了数据表中的所有行,而不仅仅是活动页面中的行.那么我怎样才能做到这一点来单独检查当前页面中的行?

But the problem is it is selecting all rows in the datatable, not just the rows in the active page. So how can I achieve that to check rows in the current page alone?

推荐答案

我已经得到了我的问题的答案,并与有类似问题的人分享..

I've got an answer to my question and sharing for those with similar issue..

var table = $('#tbl_questions').DataTable();
var p = table.rows({ page: 'current' }).nodes();

将只返回当前页面中的所有行..

will return all the rows in the current page only..

这篇关于仅选择活动页面中的所有行 jquery 数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆