Select all checkboxes in current page
Select all checkboxes in current page
swamyveera
Posts: 4Questions: 0Answers: 0
Hi there,
This is my code
[code]
var oTable=$("table#da-list").dataTable({
sPaginationType: "full_numbers",
"bStateSave": true,
"aoColumns":[
{"bSortable":false},
null,null,null,null,
{"bSortable":false}
]
});
var nodes=oTable.fnGetNodes();
$("#checkbox-main-header").click(function(){
if($(this).is(":checked")){
$('.checkbox-tr',nodes).attr("checked",true);
}else{
$('.checkbox-tr',nodes).attr("checked",false);
}
});
[/code]
But this modifies checkboxes in all pages. How can i select only the ones in the current page?
Thanks
This is my code
[code]
var oTable=$("table#da-list").dataTable({
sPaginationType: "full_numbers",
"bStateSave": true,
"aoColumns":[
{"bSortable":false},
null,null,null,null,
{"bSortable":false}
]
});
var nodes=oTable.fnGetNodes();
$("#checkbox-main-header").click(function(){
if($(this).is(":checked")){
$('.checkbox-tr',nodes).attr("checked",true);
}else{
$('.checkbox-tr',nodes).attr("checked",false);
}
});
[/code]
But this modifies checkboxes in all pages. How can i select only the ones in the current page?
Thanks
This discussion has been closed.
Replies
[code]
$('.checkbox-tr').attr("checked",true);
[/code]
Allan
That worked!
My "select all" check box is in the header.
So when i check it, all the checkboxes in the current page are selected.
But, when i move to the next page, the "select all" checkbox is still checked.
Any quick way to sort this out?