Hide row child
Hide row child
![silens](https://secure.gravatar.com/avatar/e611851f50976b3be0398c1822a0b1f6/?default=https%3A%2F%2Fvanillicon.com%2Fe611851f50976b3be0398c1822a0b1f6_200.png&rating=g&size=120)
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![:) :)](https://datatables.net/forums/resources/emoji/smile.png)