0
I have a table that brings data from comic’s cameras and through it I check the cameras and write their id in the same column divided by ','. I wanted to know how I do for when I go to edit bring the data of the cameras and mark the ones that were registered in the bank.
code of how to load table cameras
Function loads_cameras(){
var url = "../api/cameras/return.php?condominio_id="+$("#condominio_id").val();
$.post(url, function( data ) {
var temp = '';
temp = "<thead><tr><th onclick=\"selall2();\">Selecionar</th><th>ID</th><th>Descrição</th><th>Tipo</th></tr></thead><tbody>";
$.each(data,function(index,value){
temp+="<tr>"+
"<td><input type=\"checkbox\" id=\"user-"+value.id+"\" name=\"user-"+value.id+"\" class=\"scheck2\"/></td>"+
"<td>"+value.id+"</td>"+
"<td>"+value.descricao+"</td>"+
"<td>"+value.tipo+"</td>"+
"</tr>";
});
temp+= "</tbody>";
if (table2 != false){
table2.destroy();
}
$('#tabelacameras').html(temp);
setTimeout(function(){
if ( $.fn.dataTable.isDataTable( '#tabelacameras' ) ) {
table2 = $('#tabelacameras').DataTable();
}else {
table2 = $('#tabelacameras').DataTable( {
paging: false,
} );
}
},800);
},"json");
}