Troubles removing a child from a row.
Troubles removing a child from a row.
Im trying to close all childs on my table, but when i do it, then it get bugged and i can't open any other child.
$('#tablaConsultarPolizasComisiones').DataTable().rows().eq(0).each( function ( idx ) {
var row = $('#tablaConsultarPolizasComisiones').DataTable().row( idx );
if ( row.child.isShown() ) {
$('div.slider').hide(function(){
row.child.hide();
tr.removeClass('shown');
});
~~~~
}
});
This is how i open the childs (This section is working perfectly).
$('#tablaConsultarPolizasComisiones tbody').on('click', '.details-control', function () {
var tr = $(this).closest('tr');
var rowAux = $('#tablaConsultarPolizasComisiones').DataTable().row( tr );
$('#tablaConsultarPolizasComisiones').DataTable().rows().eq(0).each( function ( idx ) {
var row = $('#tablaConsultarPolizasComisiones').DataTable().row( idx );
if ( row.child.isShown() && (row.data() != rowAux.data()) ) {
$('div.slider').hide(function(){
row.child.hide();
tr.removeClass('shown');
});;
}
});
var tr = $(this).closest('tr');
var row = $('#tablaConsultarPolizasComisiones').DataTable().row( tr );
for(var i = 0; i < self.polizas.length; i++){
if(self.polizas[i].numero == row.data()[0]){
self.polizas[i].editar = true;
self.polizaSeleccionada = i;
break;
}
}
if ( !row.child.isShown() ) {
console.log('ishown');
$('.slider').show();
row.child( $('div.slider') ).show();
tr.addClass('shown');
$('div.slider', row.child()).slideDown();
}
});
$('div.slider') is the div that i use as a child.