I have a search screen where it displays the data. If I get 200 rows. selectAll selects all the checkboxes for all the rows.
My problem is when user filter the rows by selecting filter options rows will reduce to 70 or so based on the filter at that time my selectAll still selects all 200 rows. I want to select only the filtered rows. We are using jQuery for filtering the code for this is below. If possible pure JavaScript solution would be best (as I don't know much about jQuery). jQuery is last preference but OK. I would just be happy to get the page working.
Here is my code :
<script src="js/jquery-1.4.4.min.js" type="text/javascript" />
<script src="js/jquery.tablesorter.js"></script>
<script src="js/jquery.tablesorter.widgets.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.pager.js"></script>
<h:commandButton type="button" id="selectAll" value="Select All" onclick="selectAllCheckboxes()">
selectAllCheckboxes()
Code below :
var checkboxes = table.getElementsByTagName('INPUT');
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].type == 'checkbox' && checkboxes[i].disabled ==false) {
checkboxes[i].checked = true;
}
}