Expandable cells

Expandable cells

terla21terla21 Posts: 1Questions: 1Answers: 0

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

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    This thread should help, it's asking the same thing.

    Cheers,

    Colin

This discussion has been closed.