JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css">
<body>
<table id="the-table" class="table" width="100%">
<thead>
<tr>
<th>One</th>
<th>Two</th>
<th>Count</th>
</tr>
</thead>
<tbody>
<tr id="row1">
<td>1</td>
<td>something</td>
<td>0</td>
</tr>
<tr id="row2">
<td>2</td>
<td>else</td>
<td>0</td>
</tr>
</tbody>
</table>
</body>
JavaScript
var $table = $('#the-table');
$table.dataTable({
columns: [
{
name: 'one',
data: 'one',
},
{
name: 'two',
data: 'two',
},
{
name: 'counter',
data: 'counter',
}
],
});
$table.on('draw.dt', function () {
console.log('table draw');
});
var table = $('#the-table').DataTable();
$('#the-table tbody').on('click', 'tr', function () {
var d = table.row(this).data();
d.counter++;
table
.row(this)
.data(d);
//.draw();
});