JSFiddle - React, Tailwind, and code Playground
by nmaurer
HTML
<link rel="stylesheet" href="http://datatables.net/download/build/nightly/jquery.dataTables.css">
<script src="http://datatables.net/download/build/nightly/jquery.dataTables.min.js"></script>
<table id="table">
<thead>
<tr>
<th style='width: 50%;'>Name</th>
<th>Position</th>
<th>Office</th>
<th>ExtNum</th>
<th>Start Date</th>
<th>Salary</th>
</tr>
</thead>
<tbody></tbody>
</table>
CSS
#time {
background-color: red;
font-weight: bold;
}
JavaScript
var start;
$(function () {
buildTable1();
});
function buildTable1(){
$.ajax({
dataType: 'json',
type: 'POST',
url: '/echo/json/',
data: {
json: JSON.stringify(getData())
},
'success': buildTable1_1
});
}
function buildTable1_1(data){
$('#table').dataTable({
'data': data,
'deferRender': true,
'paginate': false,
'scrollY': '250px',
'scrollCollapse': true,
'bAutoWidth': false
});
}
function getData() {
return data = [
[
"Tiger Nixon",
"System Architect",
"Edinburgh",
"5421",
"2011/04/25",
"$320,800"
],
[
"Garrett Winters",
"Accountant",
"Tokyo",
"8422",
"2011/07/25",
"$170,750"
],
[
"Ashton Cox",
"Junior Technical Author",
"San Francisco",
"1562",
"2009/01/12",
"$86,000"
],
[
"Cedric Kelly",
"Senior Javascript Developer",
"Edinburgh",
"6224",
"2012/03/29",
"$433,060"
],
[
"Airi Satou",
"Accountant",
"Tokyo",
"5407",
"2008/11/28",
"$162,700"
],
[
"Brielle Williamson",
"Integration Specialist",
"New York",
"4804",
"2012/12/02",
"$372,000"
],
[
"Herrod Chandler",
"Sales Assistant",
"San Francisco",
"9608",
"2012/08/06",
"$137,500"
],
[
"Rhona Davidson",
"Integration Specialist",
"Tokyo",
"6200",
"2010/10/14",
"$327,900"
],
[
"Colleen Hurst",
"Javascript Developer",
"San Francisco",
"2360",
"2009/09/15",
"$205,500"
],
[
"Sonya Frost",
"Software Engineer",
"Edinburgh",
"1667",
"2008/12/13",
"$103,600"
],
[
"Jena Gaines",
"Office Manager",
"London",
"3814",
...