<!DOCTYPE html>
<html>
  <head>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.js"></script>
<script src="https://cdn.datatables.net/select/1.3.4/js/dataTables.select.js"></script>
<script src="https://nightly.datatables.net/searchpanes/js/dataTables.searchPanes.js?asduazxcxzandf;liona;"></script>
<script src="https://nightly.datatables.net/buttons/js/dataTables.buttons.js"></script>
<!-- this breaks the clear button -->
<script src="https://nightly.datatables.net/searchpanes/js/searchPanes.bootstrap4.min.js?asvufsdbsbdbaubsdfvaksuv"></script>
    
<link href="https://nightly.datatables.net/buttons/css/buttons.dataTables.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
<link href="https://cdn.datatables.net/1.11.4/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.datatables.net/select/1.3.4/css/select.dataTables.css" rel="stylesheet" type="text/css" />
<link href="https://nightly.datatables.net/searchpanes/css/searchPanes.dataTables.css?asuvbausbfvkasbfdl" rel="stylesheet" type="text/css" />
<link href="https://nightly.datatables.net/searchpanes/css/searchPanes.bootstrap4.min.css?asduvblaiusbvl" rel="stylesheet" type="text/css" />
    <title>DataTables - JS Bin</title>
    <meta charset=utf-8 />
  </head>
  <body>
    <table id="parent" width="100%">
      <thead>
        <tr>
          <th>Parent Column1</th>
          <th>Parent Column2</th>
        </tr>
      </thead>
      <tfoot>
        <tr>
          <td colspan="2">
            <table id="child" width="100%">
              <thead>
                <tr>
                  <th>Child Column1</th>
                  <th>Child Column2</th>
                </tr>
              </thead>
            </table>
          </td>
        </tr>
      </tfoot>
    </table>
  </body>
</html>
 
body {
  font: 90%/1.45em "Helvetica Neue", HelveticaNeue, Verdana, Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  color: #333;
  background-color: #fff;
}
 
$(document).ready(function() {
  $('table#parent').DataTable({
// dom 'P' works fine with cascadePanes and viewTotal
//    dom: 'Pt',
// dom 'B' with cascadePanes or viewTotal throws a JS error 
    dom: 'Bt',
    ajax: 'http://showroom.efficient.it/ajax_parent.php',
    buttons: [
      {
        extend: 'searchPanes',
        config: {
          cascadePanes: true,
          viewTotal: true
        }
      }
    ],
    columns: [
      {
        data: 'parent_column1',
        searchPanes: {
          show: true
        }
      },
      {
        data: 'parent_column2',
        searchPanes: {
          show: true
        }
      }
    ]
  });
  $('table#child').DataTable({
// dom 'P' works fine with cascadePanes and viewTotal
//    dom: 'Pt',
// dom 'B' with cascadePanes or viewTotal throws a JS error 
    dom: 'Bt',
    ajax: 'http://showroom.efficient.it/ajax_child.php',
    buttons: [
      {
        extend: 'searchPanes',
        config: {
          cascadePanes: true,
          viewTotal: true
        }
      }
    ],
    columns: [
      {
        data: 'child_column1',
        searchPanes: {
          show: true
        }
      },
      {
        data: 'child_column2',
        searchPanes: {
          show: true
        }
      }
    ]
  });
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers