我想通过数据表的搜索功能过滤所有复选框。 我已经实现了使用此代码选中所有复选框。
var oTable = $('#myDataTable').dataTable({
stateSave: true,
"bDestroy": true
});
var allPages = oTable.api( ).cells( ).nodes( );
$(allPages).find('input[type="checkbox"]').prop('checked', true);
我想知道是否有任何方法可以检查通过数据表搜索过滤的某些chechkbox。 谢谢您的时间。
答案 0 :(得分:0)
oTable.api().rows( { filter : 'applied'} ).nodes()
希望这个线程将来可以帮助其他人
$('#selectAllBTN').click(function () {
var length = oTable.api().rows({filter : 'applied'}).nodes().length;
var allPages = oTable.api().rows( { filter : 'applied'} ).nodes();
for(var i=0;i<length;i++){
$(allPages[i]).find('input[type="checkbox"]').prop('checked',true);
}
})