我想中断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
}
} );
使用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;
}
})