click detail row error
click detail row error
baterista41
Posts: 5Questions: 2Answers: 0
detail in a row, add a map icon for that when you click to display a modal with my map, I make an error when you click on the detail of the line, I get this in console
TypeError: d is undefined
'<td>'+d.nombres+" "+d.apellidos+'</td>' +
data get them by ajax, data are obtained correctly, but the error is to click on the map icon in detail
var _format = function(d) {
// `d` is the original data object for the row
return '<table class="table table-inline">' +
'<tr>' +
'<td><span class="label label-success" >Responsable</span></td>' +
'<td>'+d.nombres+" "+d.apellidos+'</td>' +
'<td><span class="label label-info">Curp</span></td>' +
'<td>'+d.curp+'</td>' +
'</tr>' +
'<tr>' +
'<td><span class="label label-info">Dirección</span></td>' +
'<td>'+d.direccion+'</td>' +
'<td><span class="label label-info">Colonia</span></td>' +
'<td>'+d.colonia+'</td>' +
'</tr>' +
'<tr>' +
'<td><span class="label label-info fa fa-phone">Telefono</span></td>' +
'<td>'+d.telefono+'</td>' +
'<td><span class="label label-info">Rfc</span></td>' +
'<td>'+ d.rfc+'</td>' +
'</tr>' +
'<tr>' +
'<td><span class="label label-info">Pais</span></td>' +
'<td>'+ d.pais+'</td>' +
'<td><span class="label label-info">Codigo Postal</span></td>' +
'<td>'+ d.codigo_postal+'</td>' +
'</tr>' +
'<tr>' +
'<td><span class="label label-info">Localizacion</span></td>' +
'<td><span class="label label-warning"><i onclick="modalMapa();"class="fa fa-map-marker fa-2x"></i>Mapa</span> </td>' + <--------------------------------------------------------!!here click in icon map!! error
'<td><span class="label label-info">Dia de entrega</span></td>' +
'<td><span class="label label-success">'+numeroAdia(d.diaEntrega)+'</span></td>' +
'</tr>'+
'</table>';
}
$('#detailedTable tbody').on('click', 'tr', function() {
$('#id').val(table.row( this ).data()['id']);
var tr = $(this).closest('tr');
var row = table.row( tr );
var idx = $.inArray( tr.attr('id'), detailRows );
if ( row.child.isShown() ) {
tr.removeClass( 'details' );
row.child.hide();
// Remove from the 'open' array
detailRows.splice( idx, 1 );
}
else {
tr.addClass( 'details' );
row.child(_format( row.data() ) ).show();
//tr.addClass('shown');
tr.next().addClass('row-details');
// Add to the 'open' array
if ( idx === -1 ) {
detailRows.push( tr.attr('id') );
}
}
});
This discussion has been closed.