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

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

问题描述

我在gidview上使用jquery datatable,并且datatable标头上有一个复选框.该复选框的目的是检查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 Datatable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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