[英]checking if all radio buttons are checked in jquery datatables
I have a datatable and i would like to check if all radio buttons are checked but this works only for the first paginated page but fails to check the other pages 我有一个数据表,我想检查是否所有单选按钮都已选中,但这仅适用于第一个分页页面,但无法检查其他页面
this is my code: 这是我的代码:
var dt = $('#newtable').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false
});
This is what am using to check 这是用来检查的
$("input:radio").change(function() {
var all_answered = true;
dt.rows().nodes().each(function() {
if($(":radio:checked").length == 0)
{
all_answered = false;
}
})
if(all_answered==true ){
$('input[type=text]#general_comment').removeAttr("disabled");
approvebtn.removeAttr("disabled");
}else {
approvebtn.prop("disabled", "disabled");
}
});
You can bind
a page
event on your DataTable
once the datatable is initialized, which on pagination (page change) will check what you want. 一旦
DataTable
被初始化,您就可以在您的DataTable
上bind
一个page
事件,在分页(页面更改)时它将检查您想要的内容。
$('#newtable').bind('page', function () {
//call to check what you want.
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.