Method not getting called. the values of id, and ‘checked’ when calling updateSelectedID but breakpoints indicate that id=parseInt(id) is not getting executed. Suggestions for troubleshooting?
// Id array
var poId_Checked = [];
function updateSelectedID(id, checked) {
id = parseInt(id);
if (checked) {
if (!poId_Checked.includes(id)) {
poId_Checked.push(id);
}
} else {
const index = poId_Checked.indexOf(id);
if (index !== -1) {
poId_Checked.splice(index, 1);
}
}
$('#poIdChecked').val(poId_Checked);
}
// Handle single checkbox
function selectPoIDCheckBox(id) {
const checked = $('input.checkItem[data-id="' + id + '"]').prop('checked');
updateSelectedID(id, checked);
if (checked) {
var currentPageRows = table.rows({ page: 'all' });
// Get the checked checkboxes within those rows
var checkedCheckboxes = currentPageRows.nodes().to$().find('input[type="checkbox"]:checked');
var checkCheckboxes = currentPageRows.nodes().to$().find('input[type="checkbox"]');
// Get the length of the checked checkboxes
var checkedLength = checkedCheckboxes.length;
var checkLength = checkCheckboxes.length;
// Log the result to the console
var allChecked = checkedLength === checkLength;
$('#poIdCheckAll').prop('checked', allChecked);
} else {
$('#poIdCheckAll').prop('checked', false);
}
}
Expected breakpoints to stop at parseInt, but it appears either breakpoints are not working or the method is not actually getting called.