Expandable cells
Expandable cells
Hello guys,
I have a table, When i click in the table i would like to pen a expandable row, i have the code from datatables manual, but the thing is, i would like when i click in a cell, close the opened before, how can i do it?
! > $('#table tbody').on('click', 'td', function () {
! var tr = $(this).closest('tr');
! var row = table.row(tr);
!
! if (row.child.isShown()) {
! row.child.hide();
! tr.removeClass('shown');
!
! }
! else {
! row.child(format(row.data())).show();
! tr.show();
! tr.addClass('shown');
!
! }
!
! });
Answers
This thread should help, it's asking the same thing.
Cheers,
Colin