Hide row child
Hide row child
silens
Posts: 101Questions: 40Answers: 0
https://datatables.net/examples/api/row_details.html
I would like that when I click on a row, its daughter row will be shown and all other rows will be closed
$('#tbl_Facturas tbody').on('click', 'button.albaranes', function () {
var tr = $(this).parents('tr');
var row = tblFacturas.row();
var idFact = tblFacturas.row($(this).parents()).data();
if (row.child.isShown()) {//Esta mostrado
row.child.hide();
tr.removeClass('shown');
}
else
{
alb_fact(idFact['id'], function (tblAlbFact) {
row.child(tblAlbFact).show(); //Esta escondido, llamo a la función
tr.addClass('shown'); //Muestro el hijo.
});
}
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @silens ,
This should do the trick for you - only one child is opened at a time.
Cheers,
Colin
Thank you very much for answering, it works fine but I need to have the possibility of closing the same one that I open. In this way, one is always left open.
Hi again, that's an easy one: http://live.datatables.net/yuhumoxo/2/edit
Muchisimas gracias.
De nada