datatable

by Piotr Sieniawski

HTML

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.css">
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.1.1/css/responsive.dataTables.min.css">
<script src="https://cdn.datatables.net/responsive/2.1.1/js/dataTables.responsive.min.js"></script>
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
<div id="tableContainer">
  <table id="myTable" class="display responsive no-wrap" width="100%">
    <thead>
      <tr>
        <th>Name</th>
        <th>Position</th>
        <th>Office</th>
        <th>Extn.</th>
        <th>Start date</th>
        <th>Salary</th>
      </tr>
    </thead>
  </table>

</div>

JavaScript

$("#tableContainer").hide();
console.log('Datatable initializing');
var dataSet = [
  ["Tiger Nixon", "System Architect", "Edinburgh", "5421", "2011/04/25", "$320,800"],
  ["Garrett Winters", "Accountant", "Tokyo", "8422", "2011/07/25", "$170,750"]
];
$('#myTable').DataTable({
  data: dataSet
});
console.log('Datatable initialized');
$("#tableContainer").show();