JSFiddle - React, Tailwind, and code Playground

Statistik nach tabedit -> Ergebnisübersicht

by ltdeta

HTML

<link rel="stylesheet" href="https://cdn.datatables.net/1.10.11/css/dataTables.jqueryui.min.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.1.4.min.js"></script>
<script src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.11/js/dataTables.jqueryui.min.js"></script>

<button id="start">ShowHide</button>
<div id="showhide" style="margin-bottom:20px;">
  <table id="example" class="display compact" cellpadding="0" cellspacing="0" width="99%" border="1">
    <thead>
      <tr>
        <th>Name</th>
        <th>Position</th>
        <th>Office</th>
        <th>Age</th>
        <th>Start date</th>
        <th>Salary</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Tiger Nixon</td>
        <td>System Architect</td>
        <td>Edinburgh</td>
        <td>61</td>
        <td>2011/04/25</td>
        <td>$320,800</td>
      </tr>

    </tbody>
  </table>
</div>

<table id="example1" class="display" cellspacing="0" width="100%">
  <thead>
    <tr>
      <th>Name</th>
      <th>Position</th>
      <th>Office</th>
      <th>Age</th>
      <th>Start date</th>
      <th>Salary</th>
    </tr>
  </thead>
  <tfoot>
    <tr>
      <th>Name</th>
      <th>Position</th>
      <th>Office</th>
      <th>Age</th>
      <th>Start date</th>
      <th>Salary</th>
    </tr>
  </tfoot>
 <thead>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </tfoot>
        <tbody>
           ...

CSS

table.dataTable.compact thead th,
table.dataTable.compact thead td {
  padding: 2px 2px;
}

table.dataTable.compact tbody th,
table.dataTable.compact tbody td {
  padding: 2px 2px;
}

table.dataTable thead th,
table.dataTable tfoot th {
  font-weight: normal;
}

JavaScript

$(document).ready(function() {
      $('#example').DataTable({
        bSort: false,
        responsive: true,
        bPaginate: false,
        sDom: '<"customTitle"><"ui-helper-clearfix ui-corner-tl ui-corner-tr">',
      });

      $('#example1').DataTable();

    });
    $("div.customTitle").html('<br/><b style="margin-left:5px;">Ergebnisübersicht:</b>');

    $("#start").click(function() {
      $("#showhide").toggle();
    });