REINITIALIZE DATATABLE ERROR
REINITIALIZE DATATABLE ERROR

hi i create a datatable using AJAX and i add a column with a icon, that is clickable, this show a form
the problem come when i reinitilize the table, then send a error when i click the icon
function openbloq(data)
{
var datatbl = 0;
var width = $(window).width();
var height = $(window).height();
$( "#bloqueosdiag" ).dialog( "option", "width", width );
$( "#bloqueosdiag" ).dialog( "open" );
adltot=0;
jrtot=0;
mnrtot=0;
ntstot=0;
totalgrup=0;
$.ajax({
url: "app/conexiones/habitaciones.php",
data: {"idbloq" : data['id'] } ,
type: "POST"
}).done(function(respuesta){
var resp = JSON.parse(respuesta);
var obj = resp["hab"];
var r = 0;
var dataSet = resp["tabla"];
var table = $('#example').DataTable( {
data: dataSet,
"paging": false,
"ordering": false,
"destroy" : true,
"searching": false,
"info": false,
"columnDefs": [{
"targets": -1,
"data": null,
"defaultContent": "<i style='cursor:pointer; font-size: 20px; padding-top: 0px;' class='fa fa-edit'></i>"
}],
responsive: true
} );
$("th").removeClass("sorting_asc");
$('#example tbody').on( 'click', 'i', function () {
alert(table.row( $(this).parents('tr') ).data());
datatbl = table.row( $(this).parents('tr') ).data();
alert(datatbl[1] );
infocheck(datatbl, data['hotel']);
} );
});
}
the code where i destroy the table
$( "#bloqueosdiag" ).dialog({
width: $(window).width(),
height: $(window).height(),
position: { my: "center top", at: "center top", collision: 'fit fit', of: '.wrapper'},
draggable: true,
modal: true,
appendTo: ".content-wrapper",
responsive: true,
resizable: false,
close: function() {
$('#example').DataTable().clear();
$('#example').DataTable().destroy();
$("#example tbody").html("");
$("#grupo").html("");
$("#fecha").html("FECHA: ");
$("#hotel").html("PROPIEDAD: ");
}
})
the error:
(index):505 Uncaught TypeError: Cannot read property '1' of undefined
at HTMLElement.<anonymous> ((index):505)
at HTMLTableSectionElement.dispatch (jquery.min.js:2)
at HTMLTableSectionElement.v.handle (jquery.min.js:2)****
This discussion has been closed.
Replies
Happy to take a look at a test case that shows the error.
Allan