我想中断 DataTable() 交互。这是我的代码 let allCheckboxChecked=true; let table = $('#myTable').DataTable(); table.rows().iterator( 'row', function ( context, index ) { if($(this.row(index).node()).find("input").is(":Checked")){ allCheckboxChecked=true; } else{ allCheckboxChecked=false; **return true;** // This is not working...I want your help here } } );
1 回答

喵喔喔
TA贡献1735条经验 获得超5个赞
使用nodes()而不是iterator()
table.rows().nodes().to$().find('input:not(:checked):first').length // 0 - all checked
或与each()
let allCheckboxChecked = true;
table.rows().nodes().to$().each(function () {
if (!$(this).find('input').is(':checked')) {
allCheckboxChecked = false;
return false;
}
})
添加回答
举报
0/150
提交
取消