Select all checkboxes on filtered entries
Select all checkboxes on filtered entries
Hi all, I've read a few threads discussing how to select/deselect all checkboxes using fnGetNodes() and this works well. For example, the following:
[code]$('input', oTable.fnGetNodes()).attr('checked', this.checked);[/code]
But I want to have the ability to select all of the filtered entries, not all of the entries in the entire grid. The code above selects all checkboxes, even if they are currently hidden due to some search criteria. Also, I would like it to select all of these filtered entries whether they are visible or not. For instance, say I enter some search criteria and filter the entries down to 35 out of 100, of which 25 are visible. If I click on a select all checkbox, I'd like all 35 to be selected, not just the 25 visible ones.
Does anyone know how to do this?
Thanks!
[code]$('input', oTable.fnGetNodes()).attr('checked', this.checked);[/code]
But I want to have the ability to select all of the filtered entries, not all of the entries in the entire grid. The code above selects all checkboxes, even if they are currently hidden due to some search criteria. Also, I would like it to select all of these filtered entries whether they are visible or not. For instance, say I enter some search criteria and filter the entries down to 35 out of 100, of which 25 are visible. If I click on a select all checkbox, I'd like all 35 to be selected, not just the 25 visible ones.
Does anyone know how to do this?
Thanks!
This discussion has been closed.
Replies
[code]$("th").each(function(i) {
if (this.innerHTML == "Run Immediately") {
var dd = 'Select All Jobs
';
$('#jobs').before("" + dd + '');
// if we are selecting nodes, then only select the filtered checkboxes
// if we are deselecting nodes, then deselect ALL checkboxes
$("#selectAllJobsDD").click(function() {
var checked = this.checked;
if (checked) {
$('input', oTable.fnGetFilteredNodes()).attr('checked', checked);
}
else {
$('input', oTable.fnGetNodes()).attr('checked', checked);
}
});
}
});[/code]