Basically I have a dataTable that displays all the records from the database, and a checkbox for each row within the table. My table has multiple pages. The problem was that I can only get the checkbox values of the current page selected because the system can only see checkboxes that are visible. I want to get specific checked values or all checked values from different pages and push them to the array. How can I achieve this? I can only get the checked value of current selected page in datatable atm. I have searched and tried similar problem, but it's still not working.
Below is my code
PHP code to display checkboxes
foreach($stmt as $row){echo "<tr><td>"."<input type='checkbox' name='check_list' id='checklist' value='$row['id']' style='width:20px; height: 20px'/>"}
Javascript code
function getCheckboxVals(){
var check = $('input[name="check_list"]:checked').length;
var mycheckboxes = new Array();
//IF NO CHECKBOX CHECKS
if(check == 0){
eModal.alert('PLEASE SELECT ISSUES BEFORE YOU EXPORT CONTENTS!!!');
return false;
}
//IF ONE OR MORE CHECKBOXES CHECK
if(check == 1){
$('input[name="check_list"]:checked', table.fnGetNodes()).serialize().each(function(){
mycheckboxes.push(this.value);
});
}else{
$('input[name="check_list"]:checked').each(function(){
mycheckboxes.push(this.value);
});
}
}