大佬教程收集整理的这篇文章主要介绍了如何在不检查jquery数据表中当前页面数据的不同页面上实现“全部检查”功能?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在我的表中有以下功能:
2)单击thead中的“全选”复选框应仅选中/取消选中所有当前可见的记录.
3)“全选”按钮应保持不同数据表页面的状态(已选中/未选中).例如. – 如果用户单击第1页上的全选并导航到下一页,则应取消选中全选复选框,再次单击它将仅检查此页面中的所有行,而先前选中的复选框不受影响.
$('#SELEctAllcheck').click(function(E) { var chk = $(this).prop('checked'); var currentRows = $('#myTable tbody tr'); $.each(currentRows,function(){ $(this).find(':checkBox[name=statuscheckBox]').each(function(){ $(this).prop('checked',chk); }); }); });
我知道_(‘tr’,{“过滤器”:“应用”});功能,但它只是将所有行返回给我.我不知道为什么.
我已经用上面的代码实现了(1)和(2),它工作正常.唯一的问题是不同页面上“全选”功能的行为.我抬头看着datatables.net但找不到与此有关的任何内容.
$(document).ready(function() { oTable = $('#myTable').dataTable({ "bJQueryUI" : true,"sPaginationType" : "full_numbers","fnDrawCallBACk": function( setTings ) { //managing the "SELEct all" checkBox // everytime the table is drawn,it checks if all the //checkBoxes are checked and if they are,then the SELEct all // checkBox in the table header is SELEcted var allchecked = true; $('#myTable tbody tr').each(function() { $(this).find(':checkBox[name=statuscheckBox]').each(function(){ if (!$(this).is(':checked')) { allchecked = false; } }); }); $('#SELEctAllcheck').prop('checked',allchecked); },}); // This is to stop datatable to sort the column on checking the checkBox $('thead').click(function(E){ if (e.target.type == 'checkBox') { e.stopPropogation(); } }); // Click handler for SELEct all checkBox that checks the rows on current view only $('#SELEctAllcheck').click(function(E) { var chk = $(this).prop('checked'); var currentRows = $('#myTable tbody tr'); $.each(currentRows,chk); }); }); });
});
以上是大佬教程为你收集整理的如何在不检查jquery数据表中当前页面数据的不同页面上实现“全部检查”功能?全部内容,希望文章能够帮你解决如何在不检查jquery数据表中当前页面数据的不同页面上实现“全部检查”功能?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。