I've tried everything I'm aware of trying to make this work, but I'm still not able to.
All I need is a "select all" checkbox, do a loop to every element to set their classes and save their id in a session variable. So far I get every part of this code, except to visually see the checkbox checked.
Here is my code:
$('#all').on('change', function () {
if($(this).is(':checked')){
table.$("input[type='checkbox']").each( function() {
console.log($(this).attr("id"));
$(this).prop( "checked" ,true);
console.log($(this).prop("checked"));
var id=$(this).attr("id").split('_')[1];
var id_row=table.row("#row_"+id).index()+1;
$("#tabla_equipos tr:nth-child(" + id_row + ")").addClass('active');
$("table.DTFC_Cloned>tbody tr:nth-child(" + id_row + ")").addClass('active');
funcChechboxes('{{ path('user_session_set')}}',id,'single');
});
}else{
//more code
}
});
I do get the checkboxes id on the console, and the "true" value for their "checked" prop ... even the class is applied, but not the pretty tick in the box.
console:
e_1
true
e_2
true
e_3
true
e_5
true
Any help would be much appreciated!
Regards.