Expanded/Collapsed Row Image Changing for Tbody

Expanded/Collapsed Row Image Changing for Tbody

ptepptep Posts: 3Questions: 2Answers: 0

I could use some help!

I have modified the example found here: http://datatables.net/release-datatables/examples/api/row_details.html to expand on a row click. When I expand the row, the little image icon (the plus/minus) changes not just in the row that is expanding, but for every row on the table...And I can't seem to figure it out!

Here's the code I'm working with: http://jsbin.com/kajegepi/1/edit

Thanks so much!

Answers

  • ptepptep Posts: 3Questions: 2Answers: 0

    Here's the answer for anyone else stuck in the future:

    $('#example tbody').on('click', 'tr', function() {
        var nTr = $('td',this).parents('tr')[0];
        if (fails.fnIsOpen(nTr)) {
          $(this).find('span.expand').removeClass('open');
          fails.fnClose(nTr);
       } else {
          $(this).find('span.expand').addClass('open');
          fails.fnOpen(nTr, fnFormatDetails(fails, nTr), 'details');
        }
      });
    
This discussion has been closed.