我有一个数据表,我想检查是否所有的单选按钮都被选中,但这只适用于第一个分页页面,但无法检查其他页面
这是我的代码:
var dt = $('#newtable').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false
});
这是用于检查的内容
$("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");
}
});
答案 0 :(得分:0)
初始化数据表后,您可以在bind
上page
DataTable
$('#newtable').bind('page', function () {
//call to check what you want.
});
事件,分页(页面更改)将检查您想要的内容。
public void listeningForMessages() {
PacketFilter filter = new AndFilter(new PacketTypeFilter(Message.class));
PacketCollector collector = mConnection.createPacketCollector(filter);
while (true) {
Packet packet = collector.nextResult();
if (packet instanceof Presence) {
Presence newPresence = (Presence) packet;
String fromPresence = newPresence.getFrom();
String contactJidPresence = "";
if (fromPresence.contains("/")) {
contactJidPresence = fromPresence.split("/")[0];
Log.d(TAG, "The real jid is :" + contactJidPresence);
} else {
contactJidPresence = fromPresence;
}
if (newPresence != null) {
System.out.println("Received availability update from "
+ contactJidPresence + " : "
+ (newPresence != null ? (packet) : "NULL"));
Handler handler1 = new Handler(Looper.getMainLooper());
toastThis = contactJidPresence;
handler1.post(new Runnable() {
@Override
public void run() {
//Your UI code here
if (!ChatActivity.active) {
Toast.makeText(mApplicationContext, " You received a presence from " + toastThis, Toast.LENGTH_LONG).show();
}
}
});
}
}
//Rest of the logic
}
}