title: JQuery DataTables: Show/hide row details with multiple tables
body: <p>I'm aware there's a similar question on here <a href="https://stackoverflow.com/questions/10439096/jquery-datatables-how-to-show-hide-row-details-with-multiple-tables">JQuery DataTables: How to show/hide row details with multiple tables?</a> but that doesn't apply to my current problem completely.</p>
  
  <p>I have the code:</p>
  
  <pre><code>var oTable = $('.dataTable').dataTable( {
      "aoColumnDefs": [
       { "bSortable": false, "aTargets": [ 0,3,4 ] },
       { "bVisible": false, "aTargets": [ 4 ] }
      ],  
      "aoColumns": [
        null,
        null,
        null,
        null,
        { "sType": "html" }
      ],    
      "aaSorting": [[1, 'asc']],
      "bFilter": false,
      "bPaginate": false,
      "fnInitComplete": function(oSettings) {
        /* Add event listener for opening and closing details
        * Note that the indicator for showing which row is open is not controlled by DataTables,
        * rather it is done here
        */
  
      $('.dataTable tbody td img').live('click', function () {
           var nTr = this.parentNode.parentNode;
  
           if (oTable.fnIsOpen(nTr)) {
             // This row is already open - close it
             this.src = "css/images/details_open.png";
             oTable.fnClose(nTr);
           } else {
             // Open this row
             this.src = "css/images/details_close.png";
             oTable.fnOpen(nTr, fnFormatDetails(oTable, nTr), 'details');
           }  
          } );        
        }
  });
  </code></pre>
  
  <p>That works if there's only one  if I add the dataTable class to a second table, then they work as datatables but the show/hide buttons fail in both tables. Both tables have the same count of fields and content, just for the sake of making it work, but still no success. </p>
  
  <p>On the similar post, the person suggests adding:</p>
  
  <pre><code>tbl = $(this).parent().parent().dataTable();
  </code></pre>
  
  <p>to the click function but I have tried that and it didn't work. </p>
  
  <p><strong>What am I missing??</strong></p>