JSFiddle - React, Tailwind, and code Playground
by jlujan
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>DataTables - JS Bin</title>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs-3.3.7/jq-3.3.1/dt-1.10.18/fc-3.2.5/sl-1.2.6/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs-3.3.7/jq-3.3.1/dt-1.10.18/fc-3.2.5/sl-1.2.6/datatables.min.js"></script> </head>
<body>
<div class="container">
<table id="grid" class="table table-striped table-bordered">
<thead>
<tr>
<th></th>
<th>ID</th>
<th>Nombre</th>
<th>Fecha Registro</th>
<th>Fecha ActualizaciĂłn</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>3</td>
<td>Los Bronces</td>
<td>20/09/2018 06:34</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
CSS
table.dataTable
{
margin: 0;
}
JavaScript
var grid = $('#grid').DataTable({
language: {
url: "//cdn.datatables.net/plug-ins/1.10.19/i18n/Spanish.json",
select: {
rows: {
_: "%d faenas seleccionadas",
0: "",
1: "1 faena seleccionada"
}
}
},
dom: "<'row'<'col-sm-12 col-md-4'<\"toolbar\">><'col-sm-12 col-md-4'l><'col-sm-12 col-md-4'f>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
processing: false,
serverSide: false,
colReorder: true,
orderMulti: false,
rowId: "id",
columns: [
{
data: null,
defaultContent: '',
orderable: false,
className: 'select-checkbox',
width: 35
},
{data: "id", width: 50},
{data: "nombre", width: 300},
{data: "createdAt", width: 130},
{data: "updatedAt", width: 130},
{
data: null,
className: "text-center",
orderable: false,
width: 70,
defaultContent: '<a href="" class="row-btn editor_edit" title="Editar"><i class="fas fa-pencil-alt"></i></a> <a href="" class="row-btn editor_remove" title="Eliminar"><i class="fas fa-trash-alt"></i></a>'
}
],
order: [2, "asc"],
scrollX: true,
fixedColumns: {
rightColumns: 1
},
select: {
style: 'multi',
...